HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SHA1 Class Reference

#include <hash.h>

Classes

struct  Hash
 Type for storing the raw bits of the hash. More...
 

Public Member Functions

 SHA1 (const void *data=NULL, size_t size=0)
 Create SHA1, optionally read data. More...
 
 ~SHA1 ()
 
void append (const void *data, size_t size)
 Append more data. More...
 
template<class T >
void append (span< T > v)
 Append more data from a span, without thinking about sizes. More...
 
void gethash (Hash &h)
 Get the digest and store it in Hash h. More...
 
void gethash (void *h)
 
std::string digest ()
 Return the digest as a hex string. More...
 

Static Public Member Functions

static std::string digest (const void *data, size_t size)
 Roll the whole thing into one functor, return the string digest. More...
 

Detailed Description

Class that encapsulates SHA-1 hashing, a crypticographic-strength 160-bit hash function. It's not as fast as our other hashing methods, but has an extremely low chance of having collisions.

Definition at line 548 of file hash.h.

Constructor & Destructor Documentation

SHA1::SHA1 ( const void data = NULL,
size_t  size = 0 
)

Create SHA1, optionally read data.

SHA1::~SHA1 ( )

Member Function Documentation

void SHA1::append ( const void data,
size_t  size 
)

Append more data.

template<class T >
void SHA1::append ( span< T v)
inline

Append more data from a span, without thinking about sizes.

Definition at line 558 of file hash.h.

std::string SHA1::digest ( )

Return the digest as a hex string.

static std::string SHA1::digest ( const void data,
size_t  size 
)
inlinestatic

Roll the whole thing into one functor, return the string digest.

Definition at line 578 of file hash.h.

void SHA1::gethash ( Hash h)

Get the digest and store it in Hash h.

void SHA1::gethash ( void h)
inline

Get the digest and store it in h (must point to enough storage to accommodate 20 bytes).

Definition at line 572 of file hash.h.


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