mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-23 09:59:42 +00:00
Updated documentation
This commit is contained in:
parent
13744476bd
commit
8a47758463
16
cryptlib.h
16
cryptlib.h
@ -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
|
||||
|
40
iterhash.h
40
iterhash.h
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user