LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
sha256.h File Reference

SHA-256 (FIPS 180-4), for verifying a file the port did not build. More...

#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <string>
Include dependency graph for sha256.h:

Go to the source code of this file.

Classes

class  line::util::Sha256
 Incremental SHA-256. More...

Namespaces

namespace  line
 Conservation laws of a layered queueing network, enumerated from its structure.
namespace  line::util

Functions

std::string line::util::sha256_hex (const std::string &data)
 The digest of a byte string, as 64 lowercase hex characters.
std::string line::util::sha256_file_hex (const std::string &path)
 The digest of a file's contents, streamed.

Detailed Description

SHA-256 (FIPS 180-4), for verifying a file the port did not build.

The port needs this for the one thing it downloads, JMT.jar: the transfer is delegated to curl or wget, which authenticate the SERVER, and a digest over the received bytes is what authenticates the ARTEFACT. The two answer different questions and the second is the one a jar about to be handed to a JVM raises.

Rather than link OpenSSL for one hash – a link-time obligation on every binary in the tree, for a dependency nothing else here wants – this computes it directly, as util/websocket.h already does for the SHA-1 of the handshake. It is NOT a general cryptographic toolkit and must not become one: the file digest below is its whole purpose.

sha256_file_hex streams the file in blocks and never holds it in memory, since the jar it was written for is 31 MiB.

Definition in file sha256.h.