LLVM  6.0.0svn
Public Member Functions | Static Public Member Functions | List of all members
llvm::SHA1 Class Reference

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

#include "llvm/Support/SHA1.h"

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

Public Member Functions

 SHA1 ()
 
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 160-bits SHA1 for the digested data since the last call to init(). More...
 
StringRef result ()
 Return a reference to the current raw 160-bits SHA1 for the digested data since the last call to init(). More...
 

Static Public Member Functions

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

Detailed Description

A class that wrap the SHA1 algorithm.

Definition at line 29 of file SHA1.h.

Constructor & Destructor Documentation

◆ SHA1()

llvm::SHA1::SHA1 ( )
inline

Definition at line 31 of file SHA1.h.

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

Member Function Documentation

◆ final()

StringRef SHA1::final ( )

Return a reference to 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 238 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 273 of file SHA1.cpp.

References llvm::StringRef::data(), final(), llvm::StringRef::size(), and update().

Referenced by update().

◆ init()

void SHA1::init ( )

Reinitialize the internal state.

Definition at line 85 of file SHA1.cpp.

References B, C, D, llvm::Data, E, r0(), r1(), r2(), r3(), r4(), SEED_0, SEED_1, SEED_2, SEED_3, and SEED_4.

Referenced by llvm::raw_sha1_ostream::resetHash(), and SHA1().

◆ result()

StringRef SHA1::result ( )

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

Referenced by computeCacheKey(), llvm::raw_sha1_ostream::sha1(), and update().

◆ update() [1/2]

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

Digest more data.

Definition at line 213 of file SHA1.cpp.

References C.

Referenced by computeCacheKey(), hash(), SHA1(), and update().

◆ update() [2/2]

void llvm::SHA1::update ( StringRef  Str)
inline

Digest more data.

Definition at line 40 of file SHA1.h.

References llvm::StringRef::data(), hash(), result(), llvm::StringRef::size(), and update().

Member Data Documentation

◆ Buffer

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

◆ BufferOffset

uint8_t llvm::SHA1::BufferOffset

Definition at line 74 of file SHA1.h.

◆ ByteCount

uint32_t llvm::SHA1::ByteCount

Definition at line 73 of file SHA1.h.

◆ C

uint8_t llvm::SHA1::C[BLOCK_LENGTH]

Definition at line 69 of file SHA1.h.

Referenced by init(), and update().

◆ L

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

Definition at line 70 of file SHA1.h.

◆ State

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

Definition at line 72 of file SHA1.h.


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