Provides a common interface for all the hashfunctions of the SHA-2 family. More...
#include <shax.hpp>
Public Member Functions | |
virtual void | preprocess (std::vector< uint8_t > initialMessage) |
Parses a vector of bytes and applies to it the transformations specified in the NIST's specification. | |
virtual void | round (unsigned int counter) |
Performs a round over the 16 message bytes contained in M, starting at counter and finishing at counter+"something". In the end, the internal state H is updated to the new value. | |
virtual void | hash (std::vector< uint8_t > initialMessage) |
Performs all the steps necessary to hash the message given on the input. In the end, the internal state H contains the digest of the message. | |
virtual std::vector< uint8_t > | getHash () |
Returns a vector of uint8_t containing the hash. | |
virtual std::string | getType () |
To know which hashfunction it is. | |
virtual uint32_t | getHashLength () |
To know the bitlength of the hash we should expect. |
Provides a common interface for all the hashfunctions of the SHA-2 family.
These were implemented using the NIST specification. It is available here.
|
inlinevirtual |
Returns a vector of uint8_t containing the hash.
Reimplemented in cryptoTools::SHA256, cryptoTools::SHA512, and cryptoTools::SHA384.
Definition at line 80 of file shax.hpp.
|
inlinevirtual |
To know the bitlength of the hash we should expect.
Reimplemented in cryptoTools::SHA256, cryptoTools::SHA512, and cryptoTools::SHA384.
Definition at line 101 of file shax.hpp.
|
inlinevirtual |
To know which hashfunction it is.
Reimplemented in cryptoTools::SHA256, cryptoTools::SHA512, and cryptoTools::SHA384.
Definition at line 91 of file shax.hpp.
|
inlinevirtual |
Performs all the steps necessary to hash the message given on the input. In the end, the internal state H contains the digest of the message.
Calls preprocess over its input and then uses a loop over the length of the message to call round on each of its blocks.
initialMessage | A byte vector containing the message to hash. |
Reimplemented in cryptoTools::SHA256, cryptoTools::SHA512, and cryptoTools::SHA384.
Definition at line 75 of file shax.hpp.
|
inlinevirtual |
Parses a vector of bytes and applies to it the transformations specified in the NIST's specification.
Once the call to this function is finished, the M attribute is correctly assigned i.e. it contains 32 bits words, the padding and the length of the initial input. The internal state is also initialised.
initialMessage | A byte vector containing the message to hash. |
Reimplemented in cryptoTools::SHA256, cryptoTools::SHA512, and cryptoTools::SHA384.
Definition at line 53 of file shax.hpp.
|
inlinevirtual |
Performs a round over the 16 message bytes contained in M, starting at counter and finishing at counter+"something". In the end, the internal state H is updated to the new value.
Reimplemented in cryptoTools::SHA256, cryptoTools::SHA512, and cryptoTools::SHA384.
Definition at line 61 of file shax.hpp.