mirror of https://github.com/meshcore-dev/MeshCore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
352 B
23 lines
352 B
#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);
|
|
}
|
|
|
|
|
|
}
|