Files
ZephCore/tests/support/hash_capture.cpp
T
liquidraver 159c086485 repo: publish the host regression suite; consolidate .gitignore
- tests/ (114 host cases over production sources), the CI workflow
  (ASan/UBSan on PRs and master pushes) and REGRESSION_TEST_PLAN.md
  are tracked
- .gitignore grouped and deduplicated (173 -> 96 lines, same ignored set)
2026-09-25 21:56:48 +02:00

19 lines
627 B
C++

#include <mesh/Utils.h>
#include "hash_capture.h"
#include <stdexcept>
namespace test_support {
std::vector<uint8_t> hash_input;
size_t hash_output_size = 0;
}
// Tests inspect Packet's hash preimage, NOT SHA-256 correctness. Deterministic
// marker output must never be mistaken for a digest or used in firmware builds.
void mesh::Utils::sha256(uint8_t *hash, size_t size, const uint8_t *msg, int len)
{
if (len < 0 || size != MAX_HASH_SIZE) throw std::runtime_error("unexpected hash call");
test_support::hash_input.assign(msg, msg + len);
test_support::hash_output_size = size;
memset(hash, 0xA5, size);
}