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

#include "llvm/Support/SHA256.h"

Collaboration diagram for llvm::SHA256:
Collaboration graph
[legend]

Public Member Functions

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

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. More...
 

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()

StringRef llvm::SHA256::final ( )

Return a reference to 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 246 of file SHA256.cpp.

References i.

Referenced by hash(), and llvm::object::CodeSignatureSection::write().

◆ 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 281 of file SHA256.cpp.

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

◆ init()

void llvm::SHA256::init ( )

Reinitialize the internal state.

Definition at line 55 of file SHA256.cpp.

Referenced by SHA256().

◆ result()

StringRef llvm::SHA256::result ( )

Return a reference to 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 269 of file SHA256.cpp.

◆ update() [1/2]

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

Digest more data.

Definition at line 192 of file SHA256.cpp.

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

Referenced by hash(), update(), and llvm::object::CodeSignatureSection::write().

◆ update() [2/2]

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

Digest more data.

Definition at line 220 of file SHA256.cpp.

References update().

Member Data Documentation

◆ Buffer

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.

◆ 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: