ArduinoLibs
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Member Functions | List of all members
SHA1 Class Reference

SHA-1 hash algorithm. More...

#include <SHA1.h>

Inheritance diagram for SHA1:
Hash

Public Member Functions

 SHA1 ()
 Constructs a SHA-1 hash object.
 
virtual ~SHA1 ()
 Destroys this SHA-1 hash object after clearing sensitive information.
 
size_t hashSize () const
 Size of the hash result from finalize(). More...
 
size_t blockSize () const
 Size of the internal block used by the hash algorithm. More...
 
void reset ()
 Resets the hash ready for a new hashing process. More...
 
void update (const void *data, size_t len)
 Updates the hash with more data. More...
 
void finalize (void *hash, size_t len)
 Finalizes the hashing process and returns the hash. More...
 
void clear ()
 Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing process. More...
 
- Public Member Functions inherited from Hash
 Hash ()
 Constructs a new hash object.
 
virtual ~Hash ()
 Destroys this hash object. More...
 

Detailed Description

SHA-1 hash algorithm.

Reference: http://en.wikipedia.org/wiki/SHA-1

See Also
SHA256, SHA512

Definition at line 28 of file SHA1.h.

Member Function Documentation

size_t SHA1::blockSize ( ) const
virtual

Size of the internal block used by the hash algorithm.

See Also
update(), hashSize()

Implements Hash.

Definition at line 59 of file SHA1.cpp.

void SHA1::clear ( )
virtual

Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing process.

See Also
reset()

Implements Hash.

Definition at line 137 of file SHA1.cpp.

void SHA1::finalize ( void *  hash,
size_t  len 
)
virtual

Finalizes the hashing process and returns the hash.

Parameters
hashThe buffer to return the hash value in.
lenThe length of the hash buffer, normally hashSize().

If len is less than hashSize(), then the hash value will be truncated to the first len bytes. If len is greater than hashSize(), then the remaining bytes will left unchanged.

If finalize() is called again, the same hash value is returned again until the next call to reset() or update().

See Also
reset(), update()

Implements Hash.

Definition at line 102 of file SHA1.cpp.

size_t SHA1::hashSize ( ) const
virtual

Size of the hash result from finalize().

See Also
finalize(), blockSize()

Implements Hash.

Definition at line 54 of file SHA1.cpp.

void SHA1::reset ( )
virtual

Resets the hash ready for a new hashing process.

See Also
update(), finalize()

Implements Hash.

Definition at line 64 of file SHA1.cpp.

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

Updates the hash with more data.

Parameters
dataData to be hashed.
lenNumber of bytes of data to be hashed.

If finalize() has already been called, then calling update() will reset() the hash and start a new hashing process.

See Also
reset(), finalize()

Implements Hash.

Definition at line 76 of file SHA1.cpp.


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