summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2016-04-21 04:08:06 -0400
committerJeffrey Walton <noloader@gmail.com>2016-04-21 04:08:06 -0400
commitc82f0a0d6a126e34613ac68fc3eddd91102d65bc (patch)
treedd0ff62eeb65a9251cfcccce86c35333847819b7
parent8ac5c499c2e07792105b51b9288be3e9beba3031 (diff)
downloadcryptopp-git-c82f0a0d6a126e34613ac68fc3eddd91102d65bc.tar.gz
Updated documentation
-rw-r--r--misc.h54
-rw-r--r--salsa.h2
2 files changed, 55 insertions, 1 deletions
diff --git a/misc.h b/misc.h
index 4a807473..77257bec 100644
--- a/misc.h
+++ b/misc.h
@@ -2002,13 +2002,35 @@ inline void PutWord(bool assumeAligned, ByteOrder order, byte *block, T value, c
#endif
}
+//! \class GetBlock
+//! \brief Access a block of memory
+//! \tparam T class or type
+//! \tparam B enumeration indicating endianess
+//! \tparam A flag indicating alignment
+//! \details GetBlock() provides alternate read access to a block of memory. The enumeration B is
+//! BigEndian or LittleEndian. The flag A indicates if the memory block is aligned for class or type T.
+//! Repeatedly applying \ref GetBlock::operator() "operator()" results in advancing in the block of memory.
+//! \details An example of reading two word32 values from a block of memory is shown below. <tt>w1</tt>
+//! will be <tt>0x03020100</tt> and <tt>w1</tt> will be <tt>0x07060504</tt>.
+//! <pre>
+//! word32 w1, w2;
+//! byte buffer[8] = {0,1,2,3,4,5,6,7};
+//! GetBlock<word32, LittleEndian> block(buffer);
+//! block(w1)(w2);
+//! </pre>
template <class T, class B, bool A=false>
class GetBlock
{
public:
+ //! \brief Construct a GetBlock
+ //! \param block the memory block
GetBlock(const void *block)
: m_block((const byte *)block) {}
+ //! \brief Access a block of memory
+ //! \tparam U class or type
+ //! \param x the value to read
+ //! \returns pointer to the remainder of the block after reading x
template <class U>
inline GetBlock<T, B, A> & operator()(U &x)
{
@@ -2022,13 +2044,36 @@ private:
const byte *m_block;
};
+//! \class PutBlock
+//! \brief Access a block of memory
+//! \tparam T class or type
+//! \tparam B enumeration indicating endianess
+//! \tparam A flag indicating alignment
+//! \details GetBlock() provides alternate write access to a block of memory. The enumeration B is
+//! BigEndian or LittleEndian. The flag A indicates if the memory block is aligned for class or type T.
+//! Repeatedly applying \ref PutBlock::operator() "operator()" results in advancing in the block of memory.
+//! \details An example of reading two word32 values from a block of memory is shown below. <tt>w1</tt>
+//! will be <tt>0x03020100</tt> and <tt>w1</tt> will be <tt>0x07060504</tt>.
+//! <pre>
+//! word32 w1, w2;
+//! byte buffer[8] = {0,1,2,3,4,5,6,7};
+//! GetBlock<word32, LittleEndian> block(buffer);
+//! block(w1)(w2);
+//! </pre>
template <class T, class B, bool A=false>
class PutBlock
{
public:
+ //! \brief Construct a PutBlock
+ //! \param block the memory block
+ //! \param xorBlock optional mask
PutBlock(const void *xorBlock, void *block)
: m_xorBlock((const byte *)xorBlock), m_block((byte *)block) {}
+ //! \brief Access a block of memory
+ //! \tparam U class or type
+ //! \param x the value to write
+ //! \returns pointer to the remainder of the block after writing x
template <class U>
inline PutBlock<T, B, A> & operator()(U x)
{
@@ -2044,6 +2089,15 @@ private:
byte *m_block;
};
+//! \class BlockGetAndPut
+//! \brief Access a block of memory
+//! \tparam T class or type
+//! \tparam B enumeration indicating endianess
+//! \tparam GA flag indicating alignment for the Get operation
+//! \tparam PA flag indicating alignment for the Put operation
+//! \details GetBlock() provides alternate write access to a block of memory. The enumeration B is
+//! BigEndian or LittleEndian. The flag A indicates if the memory block is aligned for class or type T.
+//! \sa GetBlock() and PutBlock().
template <class T, class B, bool GA=false, bool PA=false>
struct BlockGetAndPut
{
diff --git a/salsa.h b/salsa.h
index 37742400..54d1ec69 100644
--- a/salsa.h
+++ b/salsa.h
@@ -44,7 +44,7 @@ protected:
//! \class Salsa20
//! \brief Salsa20 stream cipher information
-//! \details XSalsa20 provides a variable number of rounds: 8, 12 or 20. The default number of rounds is 20.
+//! \details Salsa20 provides a variable number of rounds: 8, 12 or 20. The default number of rounds is 20.
//! \sa <a href="http://www.cryptolounge.org/wiki/XSalsa20">XSalsa20</a>
struct Salsa20 : public Salsa20_Info, public SymmetricCipherDocumentation
{