LLVM 20.0.0git
Public Member Functions | Static Public Member Functions | List of all members
llvm::SHA256 Class Reference

#include "llvm/Support/SHA256.h"

Public Member Functions

 SHA256 ()
 
void init ()
 Reinitialize the internal state.
 
void update (ArrayRef< uint8_t > Data)
 Digest more data.
 
void update (StringRef Str)
 Digest more data.
 
std::array< uint8_t, 32 > final ()
 Return the current raw 256-bits SHA256 for the digested data since the last call to init().
 
std::array< uint8_t, 32 > result ()
 Return the current raw 256-bits SHA256 for the digested data since the last call to init().
 

Static Public Member Functions

static std::array< uint8_t, 32 > hash (ArrayRef< uint8_t > Data)
 Returns a raw 256-bit SHA256 hash for the given data.
 

Detailed Description

Definition at line 33 of file SHA256.h.

Constructor & Destructor Documentation

◆ SHA256()

llvm::SHA256::SHA256 ( )
inlineexplicit

Definition at line 35 of file SHA256.h.

References init().

Member Function Documentation

◆ final()

std::array< uint8_t, 32 > llvm::SHA256::final ( )

Return the current raw 256-bits SHA256 for the digested data since the last call to init().

This call will add data to the internal state and as such is not suited for getting an intermediate result (see result()).

Definition at line 258 of file SHA256.cpp.

Referenced by hash().

◆ hash()

std::array< uint8_t, 32 > llvm::SHA256::hash ( ArrayRef< uint8_t >  Data)
static

Returns a raw 256-bit SHA256 hash for the given data.

Definition at line 280 of file SHA256.cpp.

References llvm::Data, final(), and update().

◆ init()

void llvm::SHA256::init ( )

Reinitialize the internal state.

Definition at line 51 of file SHA256.cpp.

Referenced by SHA256().

◆ result()

std::array< uint8_t, 32 > llvm::SHA256::result ( )

Return the current raw 256-bits SHA256 for the digested data since the last call to init().

This is suitable for getting the SHA256 at any time without invalidating the internal state so that more calls can be made into update.

Definition at line 268 of file SHA256.cpp.

◆ update() [1/2]

void llvm::SHA256::update ( ArrayRef< uint8_t >  Data)

Digest more data.

Definition at line 187 of file SHA256.cpp.

References assert(), C, llvm::Data, I, and llvm::support::endian::read32be().

Referenced by hash(), and update().

◆ update() [2/2]

void llvm::SHA256::update ( StringRef  Str)

Digest more data.

Definition at line 215 of file SHA256.cpp.

References update().

Member Data Documentation

◆ 

union { ... } llvm::SHA256::Buffer

◆ BufferOffset

uint8_t llvm::SHA256::BufferOffset

Definition at line 75 of file SHA256.h.

◆ ByteCount

uint32_t llvm::SHA256::ByteCount

Definition at line 74 of file SHA256.h.

◆ C

uint8_t llvm::SHA256::C[BLOCK_LENGTH]

Definition at line 70 of file SHA256.h.

Referenced by update().

◆ L

uint32_t llvm::SHA256::L[BLOCK_LENGTH/4]

Definition at line 71 of file SHA256.h.

◆ State

uint32_t llvm::SHA256::State[HASH_LENGTH/4]

Definition at line 73 of file SHA256.h.


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