Thrill  0.1

Detailed Description

SHA-256 processor without external dependencies.

Definition at line 28 of file sha256.hpp.

#include <sha256.hpp>

Public Member Functions

 SHA256 ()
 construct empty object. More...
 
 SHA256 (const void *data, uint32_t size)
 construct context and process data range More...
 
 SHA256 (const std::string &str)
 construct context and process string More...
 
std::string digest ()
 finalize computation and return 32 byte (256 bit) digest More...
 
std::string digest_hex ()
 finalize computation and return 32 byte (256 bit) digest hex encoded More...
 
std::string digest_hex_uc ()
 finalize computation and return 32 byte (256 bit) digest upper-case hex More...
 
void finalize (void *digest)
 finalize computation and output 32 byte (256 bit) digest More...
 
void process (const void *data, uint32_t size)
 process more data More...
 
void process (const std::string &str)
 process more data More...
 

Static Public Attributes

static constexpr size_t kDigestLength = 32
 digest length in bytes More...
 

Private Attributes

uint8_t buf_ [64]
 
uint32_t curlen_
 
uint64_t length_
 
uint32_t state_ [8]
 

Constructor & Destructor Documentation

◆ SHA256() [1/3]

SHA256 ( )

construct empty object.

Definition at line 131 of file sha256.cpp.

References SHA256::curlen_, SHA256::length_, and SHA256::state_.

Referenced by tlx::sha256_hex(), and tlx::sha256_hex_uc().

◆ SHA256() [2/3]

SHA256 ( const void *  data,
uint32_t  size 
)

construct context and process data range

Definition at line 144 of file sha256.cpp.

References SHA256::process().

◆ SHA256() [3/3]

SHA256 ( const std::string &  str)
explicit

construct context and process string

Definition at line 149 of file sha256.cpp.

References SHA256::process().

Member Function Documentation

◆ digest()

std::string digest ( )

finalize computation and return 32 byte (256 bit) digest

Definition at line 220 of file sha256.cpp.

References SHA256::finalize(), and SHA256::kDigestLength.

Referenced by SHA256::digest_hex(), and SHA256::digest_hex_uc().

◆ digest_hex()

std::string digest_hex ( )

finalize computation and return 32 byte (256 bit) digest hex encoded

Definition at line 226 of file sha256.cpp.

References SHA256::digest(), SHA256::finalize(), tlx::hexdump_lc(), and SHA256::kDigestLength.

◆ digest_hex_uc()

std::string digest_hex_uc ( )

finalize computation and return 32 byte (256 bit) digest upper-case hex

Definition at line 232 of file sha256.cpp.

References SHA256::digest(), SHA256::finalize(), tlx::hexdump(), and SHA256::kDigestLength.

◆ finalize()

void finalize ( void *  digest)

finalize computation and output 32 byte (256 bit) digest

Definition at line 189 of file sha256.cpp.

References SHA256::buf_, SHA256::curlen_, SHA256::length_, SHA256::state_, and tlx::digest_detail::store64().

Referenced by SHA256::digest(), SHA256::digest_hex(), and SHA256::digest_hex_uc().

◆ process() [1/2]

void process ( const void *  data,
uint32_t  size 
)

process more data

Definition at line 154 of file sha256.cpp.

References SHA256::buf_, SHA256::curlen_, SHA256::length_, min(), and SHA256::state_.

Referenced by SHA256::process(), and SHA256::SHA256().

◆ process() [2/2]

void process ( const std::string &  str)

process more data

Definition at line 185 of file sha256.cpp.

References SHA256::process().

Member Data Documentation

◆ buf_

uint8_t buf_[64]
private

Definition at line 60 of file sha256.hpp.

Referenced by SHA256::finalize(), and SHA256::process().

◆ curlen_

uint32_t curlen_
private

Definition at line 59 of file sha256.hpp.

Referenced by SHA256::finalize(), SHA256::process(), and SHA256::SHA256().

◆ kDigestLength

constexpr size_t kDigestLength = 32
static

digest length in bytes

Definition at line 44 of file sha256.hpp.

Referenced by SHA256::digest(), SHA256::digest_hex(), and SHA256::digest_hex_uc().

◆ length_

uint64_t length_
private

Definition at line 57 of file sha256.hpp.

Referenced by SHA256::finalize(), SHA256::process(), and SHA256::SHA256().

◆ state_

uint32_t state_[8]
private

Definition at line 58 of file sha256.hpp.

Referenced by SHA256::finalize(), SHA256::process(), and SHA256::SHA256().


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