summaryrefslogtreecommitdiff
path: root/crc.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2021-11-29 10:54:17 -0500
committerJeffrey Walton <noloader@gmail.com>2021-11-29 10:54:17 -0500
commit056084aefc52922e1b7c7c637ef0a82dd4301dfd (patch)
treec0759205c82e0214335bd4404a1111e7a1bba83a /crc.h
parenta9fe2453f6276ad36721095ba18c2bcd97fed51c (diff)
downloadcryptopp-git-056084aefc52922e1b7c7c637ef0a82dd4301dfd.tar.gz
Update documentation
Diffstat (limited to 'crc.h')
-rw-r--r--crc.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/crc.h b/crc.h
index cc0e05e8..af33c593 100644
--- a/crc.h
+++ b/crc.h
@@ -30,10 +30,16 @@ public:
void Update(const byte *input, size_t length);
void TruncatedFinal(byte *hash, size_t size);
unsigned int DigestSize() const {return DIGESTSIZE;}
- CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "CRC32";}
- std::string AlgorithmName() const {return StaticAlgorithmName();}
+ CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "CRC32";}
+ std::string AlgorithmName() const {return StaticAlgorithmName();}
+ /// \brief Updates a CRC with additional input
+ /// \param b the additional input as a byte
void UpdateByte(byte b) {m_crc = m_tab[CRC32_INDEX(m_crc) ^ b] ^ CRC32_SHIFTED(m_crc);}
+
+ /// \brief Retrieves the i-th byte of the CRC
+ /// \param i the additional input as a byte
+ /// \return the byte at the i-th position
byte GetCrcByte(size_t i) const {return reinterpret_cast<const byte *>(&m_crc)[i];}
std::string AlgorithmProvider() const;
@@ -57,10 +63,16 @@ public:
void Update(const byte *input, size_t length);
void TruncatedFinal(byte *hash, size_t size);
unsigned int DigestSize() const {return DIGESTSIZE;}
- CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "CRC32C";}
- std::string AlgorithmName() const {return StaticAlgorithmName();}
+ CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "CRC32C";}
+ std::string AlgorithmName() const {return StaticAlgorithmName();}
+ /// \brief Updates a CRC with additional input
+ /// \param b the additional input as a byte
void UpdateByte(byte b) {m_crc = m_tab[CRC32_INDEX(m_crc) ^ b] ^ CRC32_SHIFTED(m_crc);}
+
+ /// \brief Retrieves the i-th byte of the CRC
+ /// \param i the additional input as a byte
+ /// \return the byte at the i-th position
byte GetCrcByte(size_t i) const {return reinterpret_cast<const byte *>(&m_crc)[i];}
std::string AlgorithmProvider() const;