openMSX
Public Member Functions | Static Public Member Functions | List of all members
openmsx::SHA1 Class Reference

Helper class to perform a sha1 calculation. More...

#include <sha1.hh>

Public Member Functions

 SHA1 ()
 
void update (const uint8_t *data, size_t len)
 Incrementally calculate the hash value. More...
 
Sha1Sum digest ()
 Get the final hash. More...
 

Static Public Member Functions

static Sha1Sum calc (const uint8_t *data, size_t len)
 Easier to use interface, if you can pass all data in one go. More...
 
static Sha1Sum calcWithProgress (const uint8_t *data, size_t len, const std::string &filename, CliComm &cliComm, EventDistributor &distributor)
 Easier to use interface, if you can pass all data in one go. More...
 

Detailed Description

Helper class to perform a sha1 calculation.

Basic usage:

Definition at line 53 of file sha1.hh.

Constructor & Destructor Documentation

openmsx::SHA1::SHA1 ( )

Definition at line 183 of file sha1.cc.

Member Function Documentation

Sha1Sum openmsx::SHA1::calc ( const uint8_t *  data,
size_t  len 
)
static

Easier to use interface, if you can pass all data in one go.

Definition at line 288 of file sha1.cc.

References digest(), and update().

Referenced by calcWithProgress(), and openmsx::Rom::getOriginalSHA1().

Sha1Sum openmsx::SHA1::calcWithProgress ( const uint8_t *  data,
size_t  len,
const std::string &  filename,
CliComm cliComm,
EventDistributor distributor 
)
static

Easier to use interface, if you can pass all data in one go.

But also report progress. Note that this only works when the given file is calculated completely, in one call. The caller is responsible to make sure this is the case.

Definition at line 300 of file sha1.cc.

References calc(), digest(), and update().

Sha1Sum openmsx::SHA1::digest ( )

Get the final hash.

After this method is called, calls to update() are invalid.

Definition at line 282 of file sha1.cc.

Referenced by calc(), calcWithProgress(), and openmsx::SectorAccessibleDisk::getSha1Sum().

void openmsx::SHA1::update ( const uint8_t *  data,
size_t  len 
)

Incrementally calculate the hash value.

Definition at line 245 of file sha1.cc.

Referenced by calc(), calcWithProgress(), and openmsx::SectorAccessibleDisk::getSha1Sum().


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