Updated documentation

This commit is contained in:
Jeffrey Walton 2016-09-13 16:43:12 -04:00
parent 13744476bd
commit 8a47758463
2 changed files with 48 additions and 8 deletions

View File

@ -620,8 +620,9 @@ public:
bool CanUsePredictableIVs() const {return IVRequirement() <= RANDOM_IV;}
//! \brief Determines if the object can use structured IVs
//! returns whether the object can use structured IVs, for example a counter (in addition to ones returned by
//! GetNextIV), false otherwise
//! \returns true if the object can use structured IVs, false otherwise
//! \details CanUseStructuredIVs() indicates whether the object can use structured IVs; for example a counter
//! (in addition to ones returned by GetNextIV).
bool CanUseStructuredIVs() const {return IVRequirement() <= UNIQUE_IV;}
//! \brief Returns length of the IV accepted by this object
@ -859,7 +860,10 @@ public:
//! Currently the only use of this function is CBC-CTS mode.
virtual void ProcessLastBlock(byte *outString, const byte *inString, size_t length);
//! returns the minimum size of the last block, 0 indicating the last block is not special
//! \brief Provides the size of the last block
//! \returns the minimum size of the last block
//! \details MinLastBlockSize() returns the minimum size of the last block. 0 indicates the last
//! block is not special.
virtual unsigned int MinLastBlockSize() const {return 0;}
//! \brief Encrypt or decrypt a string of bytes
@ -1028,10 +1032,8 @@ public:
//! \brief Computes the hash of the current message
//! \param digest a pointer to the buffer to receive the hash
//! \param digestSize the size of the truncated digest, in bytes
//! \details TruncatedFinal() call Final() and then copies digestSize bytes to digest
//! \details TruncatedFinal() restarts the hash for the next message.
//! \pre <tt>COUNTOF(digest) == DigestSize()</tt> or <tt>COUNTOF(digest) == HASH::DIGESTSIZE</tt> ensures
//! the output byte buffer is large enough for the digest.
//! \details TruncatedFinal() call Final() and then copies digestSize bytes to digest.
//! The hash is restarted the hash for the next message.
virtual void TruncatedFinal(byte *digest, size_t digestSize) =0;
//! \brief Updates the hash with additional input and computes the hash of the current message

View File

@ -27,13 +27,46 @@ class CRYPTOPP_NO_VTABLE IteratedHashBase : public BASE
public:
typedef T HashWordType;
//! \brief Construct an IteratedHashBase
IteratedHashBase() : m_countLo(0), m_countHi(0) {}
//! \brief Provides the input block size most efficient for this cipher.
//! \return The input block size that is most efficient for the cipher
//! \details The base class implementation returns MandatoryBlockSize().
//! \note Optimal input length is
//! <tt>n * OptimalBlockSize() - GetOptimalBlockSizeUsed()</tt> for any <tt>n \> 0</tt>.
unsigned int OptimalBlockSize() const {return this->BlockSize();}
//! \brief Provides input and output data alignment for optimal performance.
//! \return the input data alignment that provides optimal performance
//! \details OptimalDataAlignment returnes the natural alignment of the hash word.
unsigned int OptimalDataAlignment() const {return GetAlignmentOf<T>();}
//! \brief Updates a hash with additional input
//! \param input the additional input as a buffer
//! \param length the size of the buffer, in bytes
void Update(const byte *input, size_t length);
//! \brief Request space which can be written into by the caller
//! \param size the requested size of the buffer
//! \details The purpose of this method is to help avoid extra memory allocations.
//! \details size is an \a IN and \a OUT parameter and used as a hint. When the call is made,
//! size is the requested size of the buffer. When the call returns, size is the size of
//! the array returned to the caller.
//! \details The base class implementation sets size to 0 and returns NULL.
//! \note Some objects, like ArraySink, cannot create a space because its fixed.
byte * CreateUpdateSpace(size_t &size);
//! \brief Restart the hash
//! \details Discards the current state, and restart for a new message
void Restart();
void TruncatedFinal(byte *digest, size_t size);
//! \brief Computes the hash of the current message
//! \param digest a pointer to the buffer to receive the hash
//! \param digestSize the size of the truncated digest, in bytes
//! \details TruncatedFinal() call Final() and then copies digestSize bytes to digest.
//! The hash is restarted the hash for the next message.
void TruncatedFinal(byte *digest, size_t digestSize);
protected:
inline T GetBitCountHi() const {return (m_countLo >> (8*sizeof(T)-3)) + (m_countHi << 3);}
@ -72,8 +105,13 @@ public:
CRYPTOPP_COMPILE_ASSERT((T_BlockSize & (T_BlockSize - 1)) == 0); // blockSize is a power of 2
unsigned int BlockSize() const {return T_BlockSize;}
//! \brief Provides the byte order of the hash
//! \returns the byte order of the hash as an enumeration
//! \details GetByteOrder() returns <tt>T_Endianness::ToEnum()</tt>.
//! \sa ByteOrder()
ByteOrder GetByteOrder() const {return T_Endianness::ToEnum();}
//! \brief
inline static void CorrectEndianess(HashWordType *out, const HashWordType *in, size_t byteCount)
{
ConditionalByteReverse(T_Endianness::ToEnum(), out, in, byteCount);