LLVM 22.0.0git
llvm::SHA1 Class Reference

A class that wrap the SHA1 algorithm. More...

#include "llvm/Support/SHA1.h"

Public Member Functions

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

Static Public Member Functions

static LLVM_ABI std::array< uint8_t, 20 > hash (ArrayRef< uint8_t > Data)
 Returns a raw 160-bit SHA1 hash for the given data.

Detailed Description

A class that wrap the SHA1 algorithm.

Definition at line 27 of file SHA1.h.

Constructor & Destructor Documentation

◆ SHA1()

llvm::SHA1::SHA1 ( )
inline

Definition at line 29 of file SHA1.h.

References init().

Referenced by hash().

Member Function Documentation

◆ final()

std::array< uint8_t, 20 > SHA1::final ( )

Return the current raw 160-bits SHA1 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 278 of file SHA1.cpp.

Referenced by hash().

◆ hash()

std::array< uint8_t, 20 > SHA1::hash ( ArrayRef< uint8_t > Data)
static

Returns a raw 160-bit SHA1 hash for the given data.

Definition at line 300 of file SHA1.cpp.

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

◆ init()

void SHA1::init ( )

Reinitialize the internal state.

Definition at line 81 of file SHA1.cpp.

References SEED_0, SEED_1, SEED_2, SEED_3, and SEED_4.

Referenced by SHA1().

◆ result()

std::array< uint8_t, 20 > SHA1::result ( )

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

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

Definition at line 288 of file SHA1.cpp.

Referenced by llvm::computeLTOCacheKey(), and llvm::recomputeLTOCacheKey().

◆ update() [1/2]

void SHA1::update ( ArrayRef< uint8_t > Data)

Digest more data.

Definition at line 208 of file SHA1.cpp.

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

Referenced by llvm::computeLTOCacheKey(), hash(), llvm::recomputeLTOCacheKey(), and update().

◆ update() [2/2]

void SHA1::update ( StringRef Str)

Digest more data.

Definition at line 236 of file SHA1.cpp.

References update().

Member Data Documentation

◆ [union]

union { ... } llvm::SHA1::Buffer

◆ BufferOffset

uint8_t llvm::SHA1::BufferOffset

Definition at line 69 of file SHA1.h.

◆ ByteCount

uint32_t llvm::SHA1::ByteCount

Definition at line 68 of file SHA1.h.

◆ C

uint8_t llvm::SHA1::C[BLOCK_LENGTH]

Definition at line 64 of file SHA1.h.

Referenced by update().

◆ L

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

Definition at line 65 of file SHA1.h.

◆ State

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

Definition at line 67 of file SHA1.h.


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