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

#include "llvm/Support/MD5.h"

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

Classes

struct  MD5Result
 

Public Member Functions

 MD5 ()
 
void update (ArrayRef< uint8_t > Data)
 Updates the hash for the byte stream provided. More...
 
void update (StringRef Str)
 Updates the hash for the StringRef provided. More...
 
void final (MD5Result &Result)
 Finishes off the hash and puts the result in result. More...
 
StringRef final ()
 Finishes off the hash, and returns a reference to the 16-byte hash data. More...
 
StringRef result ()
 Finishes off the hash, and returns a reference to the 16-byte hash data. More...
 

Static Public Member Functions

static void stringifyResult (MD5Result &Result, SmallString< 32 > &Str)
 Translates the bytes in Res to a hex string that is deposited into Str. More...
 
static std::array< uint8_t, 16 > hash (ArrayRef< uint8_t > Data)
 Computes the hash for a given bytes. More...
 

Detailed Description

Definition at line 41 of file MD5.h.

Constructor & Destructor Documentation

◆ MD5()

MD5::MD5 ( )
default

Member Function Documentation

◆ final() [1/2]

StringRef MD5::final ( )

Finishes off the hash, and returns a reference to the 16-byte hash data.

Definition at line 265 of file MD5.cpp.

References llvm::MD5::MD5Result::Bytes.

◆ final() [2/2]

void MD5::final ( MD5Result Result)

Finishes off the hash and puts the result in result.

Finish the hash and place the resulting hash into result.

Parameters
Resultis assumed to be a minimum of 16-bytes in size.

Definition at line 235 of file MD5.cpp.

References llvm::makeArrayRef(), used, and llvm::support::endian::write32le().

Referenced by llvm::DIEHash::computeCUSignature(), computeHashString(), llvm::DIEHash::computeTypeSignature(), llvm::getUniqueModuleId(), hash(), llvm::DwarfDebug::makeTypeSignature(), llvm::sys::fs::md5_contents(), llvm::MD5Hash(), and llvm::MCContext::setGenDwarfRootFile().

◆ hash()

std::array< uint8_t, 16 > MD5::hash ( ArrayRef< uint8_t >  Data)
static

Computes the hash for a given bytes.

Definition at line 294 of file MD5.cpp.

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

◆ result()

StringRef MD5::result ( )

Finishes off the hash, and returns a reference to the 16-byte hash data.

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

Definition at line 271 of file MD5.cpp.

◆ stringifyResult()

void MD5::stringifyResult ( MD5Result Result,
SmallString< 32 > &  Str 
)
static

Translates the bytes in Res to a hex string that is deposited into Str.

The result will be of length 32.

Definition at line 290 of file MD5.cpp.

Referenced by computeHashString(), and llvm::getUniqueModuleId().

◆ update() [1/2]

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

◆ update() [2/2]

void MD5::update ( StringRef  Str)

Updates the hash for the StringRef provided.

Add the bytes in the StringRef Str to the hash.

Definition at line 228 of file MD5.cpp.

References update().

Member Data Documentation

◆ a

MD5_u32plus llvm::MD5::a = 0x67452301

Definition at line 102 of file MD5.h.

◆ b

MD5_u32plus llvm::MD5::b = 0xefcdab89

Definition at line 103 of file MD5.h.

◆ block

MD5_u32plus llvm::MD5::block[16]

Definition at line 109 of file MD5.h.

◆ buffer

uint8_t llvm::MD5::buffer[64]

Definition at line 108 of file MD5.h.

◆ c

MD5_u32plus llvm::MD5::c = 0x98badcfe

Definition at line 104 of file MD5.h.

◆ d

MD5_u32plus llvm::MD5::d = 0x10325476

Definition at line 105 of file MD5.h.

◆ hi

MD5_u32plus llvm::MD5::hi = 0

Definition at line 106 of file MD5.h.

◆ lo

MD5_u32plus llvm::MD5::lo = 0

Definition at line 107 of file MD5.h.


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