Arduino Cryptography Library
Public Member Functions | List of all members
GHASH Class Reference

Implementation of the GHASH message authenticator. More...

#include <GHASH.h>

Public Member Functions

 GHASH ()
 Constructs a new GHASH message authenticator.
 
 ~GHASH ()
 Destroys this GHASH message authenticator.
 
void reset (const void *key)
 Resets the GHASH message authenticator for a new session. More...
 
void update (const void *data, size_t len)
 Updates the message authenticator with more data. More...
 
void finalize (void *token, size_t len)
 Finalizes the authentication process and returns the token. More...
 
void pad ()
 Pads the input stream with zero bytes to a multiple of 16. More...
 
void clear ()
 Clears the authenticator's state, removing all sensitive data.
 

Detailed Description

Implementation of the GHASH message authenticator.

GHASH is the message authentication part of Galois Counter Mode (GCM).

Note
GHASH is not the same as GMAC. GHASH implements the low level hashing primitive that is used by both GCM and GMAC. GMAC can be simulated using GCM and an empty plaintext/ciphertext.

References: NIST SP 800-38D, http://en.wikipedia.org/wiki/Galois/Counter_Mode

See also
GCM

Definition at line 29 of file GHASH.h.

Member Function Documentation

◆ finalize()

void GHASH::finalize ( void *  token,
size_t  len 
)

Finalizes the authentication process and returns the token.

Parameters
tokenThe buffer to return the token value in.
lenThe length of the token buffer between 0 and 16.

If len is less than 16, then the token value will be truncated to the first len bytes. If len is greater than 16, then the remaining bytes will left unchanged.

If finalize() is called again, then the returned token value is undefined. Call reset() first to start a new authentication process.

See also
reset(), update()

Definition at line 121 of file GHASH.cpp.

◆ pad()

void GHASH::pad ( )

Pads the input stream with zero bytes to a multiple of 16.

See also
update()

Definition at line 137 of file GHASH.cpp.

◆ reset()

void GHASH::reset ( const void *  key)

Resets the GHASH message authenticator for a new session.

Parameters
keyPoints to the 16 byte authentication key.
See also
update(), finalize()

Definition at line 67 of file GHASH.cpp.

◆ update()

void GHASH::update ( const void *  data,
size_t  len 
)

Updates the message authenticator with more data.

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

If finalize() has already been called, then the behavior of update() will be undefined. Call reset() first to start a new authentication process.

See also
pad(), reset(), finalize()

Definition at line 85 of file GHASH.cpp.


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