LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::util::Sha256 Class Reference

Incremental SHA-256. More...

#include <line/util/sha256.h>

Public Member Functions

 Sha256 ()
void reset ()
void update (const void *data, std::size_t n)
void update (const std::string &s)
std::string hex ()
 Finalizes and returns the digest as 64 lowercase hex characters.

Detailed Description

Incremental SHA-256.

Feed it with update(), read the digest once with hex().

The object is SPENT by hex(): the padding is appended to the running state rather than to a copy, so a second call would digest the padding again. The two free functions below are the intended interface; this class is public only because a caller hashing something that is not a file or a string needs somewhere to put the loop.

Definition at line 65 of file sha256.h.

Constructor & Destructor Documentation

◆ Sha256()

line::util::Sha256::Sha256 ( )
inline

Definition at line 67 of file sha256.h.

References reset().

Member Function Documentation

◆ hex()

std::string line::util::Sha256::hex ( )
inline

Finalizes and returns the digest as 64 lowercase hex characters.

Definition at line 102 of file sha256.h.

References update().

Referenced by line::util::sha256_file_hex(), and line::util::sha256_hex().

◆ reset()

void line::util::Sha256::reset ( )
inline

Definition at line 69 of file sha256.h.

Referenced by Sha256().

◆ update() [1/2]

void line::util::Sha256::update ( const std::string & s)
inline

Definition at line 99 of file sha256.h.

References update().

Referenced by update().

◆ update() [2/2]

void line::util::Sha256::update ( const void * data,
std::size_t n )
inline

Definition at line 82 of file sha256.h.

Referenced by hex(), line::util::sha256_file_hex(), and line::util::sha256_hex().


The documentation for this class was generated from the following file: