Polyphase Game Engine
Loading...
Searching...
No Matches
Sha256.h
Go to the documentation of this file.
1#pragma once
2
3// Sha256
4//
5// Minimal SHA-256 helper used by the engine-runtime manifest and the
6// runtime validator. Implementation is a self-contained translation of
7// the FIPS-180-4 specification (no third-party code imported), so it is
8// license-clean for inclusion in shipping engine builds.
9//
10// Output convention: lowercase hex, 64 characters, no separators.
11
12#include <cstddef>
13#include <cstdint>
14#include <string>
15
16struct Sha256
17{
18 // Hash an arbitrary contiguous buffer.
19 static std::string HashHex(const void* data, size_t size);
20
21 // Stream-hash a file from disk in fixed-size chunks (does not load
22 // the whole file into memory). On failure, returns false and fills
23 // outError with a diagnostic. On success, outHex receives the
24 // 64-character lowercase hex digest.
25 static bool HashFileHex(const std::string& path,
26 std::string& outHex,
27 std::string& outError);
28};
Definition Sha256.h:17
static std::string HashHex(const void *data, size_t size)
Definition Sha256.cpp:174
static bool HashFileHex(const std::string &path, std::string &outHex, std::string &outError)
Definition Sha256.cpp:186