mirror of
https://github.com/pelgraine/Meck.git
synced 2026-03-28 17:42:44 +01:00
23 lines
352 B
C++
23 lines
352 B
C++
#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);
|
|
}
|
|
|
|
|
|
} |