mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-03-30 23:35:45 +00:00
Initial commit
This commit is contained in:
23
src/Packet.cpp
Normal file
23
src/Packet.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "Packet.h"
|
||||
#include <string.h>
|
||||
#include <SHA256.h>
|
||||
|
||||
namespace mesh {
|
||||
|
||||
Packet::Packet() {
|
||||
header = 0;
|
||||
path_len = 0;
|
||||
payload_len = 0;
|
||||
}
|
||||
|
||||
|
||||
void Packet::calculatePacketHash(uint8_t* hash) const {
|
||||
SHA256 sha;
|
||||
uint8_t t = getPayloadType();
|
||||
sha.update(&t, 1);
|
||||
sha.update(payload, payload_len);
|
||||
sha.finalize(hash, MAX_HASH_SIZE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user