Updated documentation for Crypto++ 1.0 algorithms

pull/339/head
Jeffrey Walton 2016-10-26 00:38:51 -04:00
parent 374105198d
commit c77029f142
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
17 changed files with 150 additions and 40 deletions

14
arc4.h
View File

@ -16,8 +16,9 @@ NAMESPACE_BEGIN(CryptoPP)
namespace Weak1 { namespace Weak1 {
//! \class ARC4_Base //! \class ARC4_Base
//! \brief Class specific methods used to operate the cipher. //! \brief ARC4 base class
//! \details Implementations and overrides in \p Base apply to both \p ENCRYPTION and \p DECRYPTION directions //! \details Implementations and overrides in \p Base apply to both \p ENCRYPTION and \p DECRYPTION directions
//! \since Crypto++ 1.0
class CRYPTOPP_NO_VTABLE ARC4_Base : public VariableKeyLength<16, 1, 256>, public RandomNumberGenerator, public SymmetricCipher, public SymmetricCipherDocumentation class CRYPTOPP_NO_VTABLE ARC4_Base : public VariableKeyLength<16, 1, 256>, public RandomNumberGenerator, public SymmetricCipher, public SymmetricCipherDocumentation
{ {
public: public:
@ -45,11 +46,14 @@ protected:
byte m_x, m_y; byte m_x, m_y;
}; };
//! <a href="http://www.weidai.com/scan-mirror/cs.html#RC4">Alleged RC4</a> //! \class ARC4
//! \brief Alleged RC4
//! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#RC4">Alleged RC4</a>
//! \since Crypto++ 1.0
DOCUMENTED_TYPEDEF(SymmetricCipherFinal<ARC4_Base>, ARC4) DOCUMENTED_TYPEDEF(SymmetricCipherFinal<ARC4_Base>, ARC4)
//! \class MARC4_Base //! \class MARC4_Base
//! \brief Class specific methods used to operate the cipher. //! \brief MARC4 base class
//! \details Implementations and overrides in \p Base apply to both \p ENCRYPTION and \p DECRYPTION directions //! \details Implementations and overrides in \p Base apply to both \p ENCRYPTION and \p DECRYPTION directions
//! \details MARC4 discards the first 256 bytes of keystream, which may be weaker than the rest //! \details MARC4 discards the first 256 bytes of keystream, which may be weaker than the rest
class CRYPTOPP_NO_VTABLE MARC4_Base : public ARC4_Base class CRYPTOPP_NO_VTABLE MARC4_Base : public ARC4_Base
@ -64,6 +68,10 @@ protected:
unsigned int GetDefaultDiscardBytes() const {return 256;} unsigned int GetDefaultDiscardBytes() const {return 256;}
}; };
//! \class MARC4
//! \brief Modified Alleged RC4
//! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#RC4">Alleged RC4</a>
//! \since Crypto++ 1.0
DOCUMENTED_TYPEDEF(SymmetricCipherFinal<MARC4_Base>, MARC4) DOCUMENTED_TYPEDEF(SymmetricCipherFinal<MARC4_Base>, MARC4)
} }

View File

@ -20,8 +20,9 @@ struct Blowfish_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 4,
// <a href="http://www.weidai.com/scan-mirror/cs.html#Blowfish">Blowfish</a> // <a href="http://www.weidai.com/scan-mirror/cs.html#Blowfish">Blowfish</a>
//! \class Blowfish_Info //! \class Blowfish
//! \brief Blowfish block cipher //! \brief Blowfish block cipher
//! \since Crypto++ 1.0
class Blowfish : public Blowfish_Info, public BlockCipherDocumentation class Blowfish : public Blowfish_Info, public BlockCipherDocumentation
{ {
//! \class Base //! \class Base

6
des.h
View File

@ -39,6 +39,7 @@ struct DES_Info : public FixedBlockSize<8>, public FixedKeyLength<8>
//! (the least significant bits of each byte) in the key. However you can use CheckKeyParityBits() //! (the least significant bits of each byte) in the key. However you can use CheckKeyParityBits()
//! and CorrectKeyParityBits() to check or correct the parity bits if you wish. //! and CorrectKeyParityBits() to check or correct the parity bits if you wish.
//! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#DES">DES</a> //! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#DES">DES</a>
//! \since Crypto++ 1.0
class DES : public DES_Info, public BlockCipherDocumentation class DES : public DES_Info, public BlockCipherDocumentation
{ {
//! \class Base //! \class Base
@ -69,7 +70,8 @@ struct DES_EDE2_Info : public FixedBlockSize<8>, public FixedKeyLength<16>
//! \class DES_EDE2 //! \class DES_EDE2
//! \brief 2-key TripleDES block cipher //! \brief 2-key TripleDES block cipher
/// \sa <a href="http://www.weidai.com/scan-mirror/cs.html#DESede">DES-EDE2</a> //! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#DESede">DES-EDE2</a>
//! \since Crypto++ 1.0
class DES_EDE2 : public DES_EDE2_Info, public BlockCipherDocumentation class DES_EDE2 : public DES_EDE2_Info, public BlockCipherDocumentation
{ {
//! \class Base //! \class Base
@ -99,6 +101,7 @@ struct DES_EDE3_Info : public FixedBlockSize<8>, public FixedKeyLength<24>
//! \class DES_EDE3 //! \class DES_EDE3
//! \brief 3-key TripleDES block cipher //! \brief 3-key TripleDES block cipher
//! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#DESede">DES-EDE3</a> //! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#DESede">DES-EDE3</a>
//! \since Crypto++ 1.0
class DES_EDE3 : public DES_EDE3_Info, public BlockCipherDocumentation class DES_EDE3 : public DES_EDE3_Info, public BlockCipherDocumentation
{ {
//! \class Base //! \class Base
@ -128,6 +131,7 @@ struct DES_XEX3_Info : public FixedBlockSize<8>, public FixedKeyLength<24>
//! \class DES_XEX3 //! \class DES_XEX3
//! \brief DESX block cipher //! \brief DESX block cipher
//! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#DESX">DES-XEX3</a>, AKA DESX //! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#DESX">DES-XEX3</a>, AKA DESX
//! \since Crypto++ 1.0
class DES_XEX3 : public DES_XEX3_Info, public BlockCipherDocumentation class DES_XEX3 : public DES_XEX3_Info, public BlockCipherDocumentation
{ {
//! \class Base //! \class Base

10
dh.h
View File

@ -19,6 +19,8 @@ NAMESPACE_BEGIN(CryptoPP)
//! \details A Diffie-Hellman domain is a set of parameters that must be shared //! \details A Diffie-Hellman domain is a set of parameters that must be shared
//! by two parties in a key agreement protocol, along with the algorithms //! by two parties in a key agreement protocol, along with the algorithms
//! for generating key pairs and deriving agreed values. //! for generating key pairs and deriving agreed values.
//! \sa DL_SimpleKeyAgreementDomainBase
//! \since Crypto++ 1.0
template <class GROUP_PARAMETERS, class COFACTOR_OPTION = CPP_TYPENAME GROUP_PARAMETERS::DefaultCofactorOption> template <class GROUP_PARAMETERS, class COFACTOR_OPTION = CPP_TYPENAME GROUP_PARAMETERS::DefaultCofactorOption>
class DH_Domain : public DL_SimpleKeyAgreementDomainBase<typename GROUP_PARAMETERS::Element> class DH_Domain : public DL_SimpleKeyAgreementDomainBase<typename GROUP_PARAMETERS::Element>
{ {
@ -30,6 +32,10 @@ public:
typedef DL_KeyAgreementAlgorithm_DH<Element, COFACTOR_OPTION> DH_Algorithm; typedef DL_KeyAgreementAlgorithm_DH<Element, COFACTOR_OPTION> DH_Algorithm;
typedef DH_Domain<GROUP_PARAMETERS, COFACTOR_OPTION> Domain; typedef DH_Domain<GROUP_PARAMETERS, COFACTOR_OPTION> Domain;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DH_Domain() {}
#endif
//! \brief Construct a Diffie-Hellman domain //! \brief Construct a Diffie-Hellman domain
DH_Domain() {} DH_Domain() {}
@ -153,10 +159,6 @@ public:
{return GroupParameters::StaticAlgorithmNamePrefix() + DH_Algorithm::StaticAlgorithmName();} {return GroupParameters::StaticAlgorithmNamePrefix() + DH_Algorithm::StaticAlgorithmName();}
std::string AlgorithmName() const {return StaticAlgorithmName();} std::string AlgorithmName() const {return StaticAlgorithmName();}
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DH_Domain() {}
#endif
private: private:
const DL_KeyAgreementAlgorithm<Element> & GetKeyAgreementAlgorithm() const const DL_KeyAgreementAlgorithm<Element> & GetKeyAgreementAlgorithm() const
{return Singleton<DH_Algorithm>().Ref();} {return Singleton<DH_Algorithm>().Ref();}

22
dh2.h
View File

@ -1,7 +1,6 @@
// dh2.h - written and placed in the public domain by Wei Dai // dh2.h - written and placed in the public domain by Wei Dai
//! \file //! \file dh2.h
//! \headerfile dh2.h
//! \brief Classes for Diffie-Hellman authenticated key exchange //! \brief Classes for Diffie-Hellman authenticated key exchange
#ifndef CRYPTOPP_DH2_H #ifndef CRYPTOPP_DH2_H
@ -11,12 +10,25 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
/// <a href="http://www.weidai.com/scan-mirror/ka.html#DH2">Unified Diffie-Hellman</a> //! \class DH2
//! \brief Unified Diffie-Hellman
//! \details A Diffie-Hellman domain is a set of parameters that must be shared
//! by two parties in a key agreement protocol, along with the algorithms
//! for generating key pairs and deriving agreed values.
//! \sa AuthenticatedKeyAgreementDomain, <a href="http://www.weidai.com/scan-mirror/ka.html#DH2">Unified Diffie-Hellman</a>
//! \since Crypto++ 1.0
class DH2 : public AuthenticatedKeyAgreementDomain class DH2 : public AuthenticatedKeyAgreementDomain
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DH2() {}
#endif
//! \brief Construct a DH2
DH2(SimpleKeyAgreementDomain &domain) DH2(SimpleKeyAgreementDomain &domain)
: d1(domain), d2(domain) {} : d1(domain), d2(domain) {}
//! \brief Construct a DH2
DH2(SimpleKeyAgreementDomain &staticDomain, SimpleKeyAgreementDomain &ephemeralDomain) DH2(SimpleKeyAgreementDomain &staticDomain, SimpleKeyAgreementDomain &ephemeralDomain)
: d1(staticDomain), d2(ephemeralDomain) {} : d1(staticDomain), d2(ephemeralDomain) {}
@ -52,10 +64,6 @@ public:
const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey, const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey,
bool validateStaticOtherPublicKey=true) const; bool validateStaticOtherPublicKey=true) const;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DH2() {}
#endif
protected: protected:
SimpleKeyAgreementDomain &d1, &d2; SimpleKeyAgreementDomain &d1, &d2;
}; };

1
dsa.h
View File

@ -33,6 +33,7 @@ enum DSASignatureFormat {
//! \details This function converts between these formats, and returns length //! \details This function converts between these formats, and returns length
//! of signature in the target format. If <tt>toFormat == DSA_P1363</tt>, then //! of signature in the target format. If <tt>toFormat == DSA_P1363</tt>, then
//! <tt>bufferSize</tt> must equal <tt>publicKey.SignatureLength()</tt> //! <tt>bufferSize</tt> must equal <tt>publicKey.SignatureLength()</tt>
//! \since Crypto++ 1.0
size_t DSAConvertSignatureFormat(byte *buffer, size_t bufferSize, DSASignatureFormat toFormat, size_t DSAConvertSignatureFormat(byte *buffer, size_t bufferSize, DSASignatureFormat toFormat,
const byte *signature, size_t signatureLen, DSASignatureFormat fromFormat); const byte *signature, size_t signatureLen, DSASignatureFormat fromFormat);

View File

@ -16,11 +16,19 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
//! \class ElGamalBase
//! \brief ElGamal key agreement and encryption schemes base class
//! \since Crypto++ 1.0
class CRYPTOPP_NO_VTABLE ElGamalBase : public DL_KeyAgreementAlgorithm_DH<Integer, NoCofactorMultiplication>, class CRYPTOPP_NO_VTABLE ElGamalBase : public DL_KeyAgreementAlgorithm_DH<Integer, NoCofactorMultiplication>,
public DL_KeyDerivationAlgorithm<Integer>, public DL_KeyDerivationAlgorithm<Integer>,
public DL_SymmetricEncryptionAlgorithm public DL_SymmetricEncryptionAlgorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~ElGamalBase() {}
#endif
void Derive(const DL_GroupParameters<Integer> &groupParams, byte *derivedKey, size_t derivedLength, const Integer &agreedElement, const Integer &ephemeralPublicKey, const NameValuePairs &derivationParams) const void Derive(const DL_GroupParameters<Integer> &groupParams, byte *derivedKey, size_t derivedLength, const Integer &agreedElement, const Integer &ephemeralPublicKey, const NameValuePairs &derivationParams) const
{ {
CRYPTOPP_UNUSED(groupParams), CRYPTOPP_UNUSED(ephemeralPublicKey), CRYPTOPP_UNUSED(derivationParams); CRYPTOPP_UNUSED(groupParams), CRYPTOPP_UNUSED(ephemeralPublicKey), CRYPTOPP_UNUSED(derivationParams);
@ -86,16 +94,20 @@ public:
} }
virtual const DL_GroupParameters_GFP & GetGroupParameters() const =0; virtual const DL_GroupParameters_GFP & GetGroupParameters() const =0;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~ElGamalBase() {}
#endif
}; };
//! \class ElGamalObjectImpl
//! \brief ElGamal key agreement and encryption schemes default implementation
//! \since Crypto++ 1.0
template <class BASE, class SCHEME_OPTIONS, class KEY> template <class BASE, class SCHEME_OPTIONS, class KEY>
class ElGamalObjectImpl : public DL_ObjectImplBase<BASE, SCHEME_OPTIONS, KEY>, public ElGamalBase class ElGamalObjectImpl : public DL_ObjectImplBase<BASE, SCHEME_OPTIONS, KEY>, public ElGamalBase
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~ElGamalObjectImpl() {}
#endif
size_t FixedMaxPlaintextLength() const {return this->MaxPlaintextLength(FixedCiphertextLength());} size_t FixedMaxPlaintextLength() const {return this->MaxPlaintextLength(FixedCiphertextLength());}
size_t FixedCiphertextLength() const {return this->CiphertextLength(0);} size_t FixedCiphertextLength() const {return this->CiphertextLength(0);}
@ -104,16 +116,14 @@ public:
DecodingResult FixedLengthDecrypt(RandomNumberGenerator &rng, const byte *cipherText, byte *plainText) const DecodingResult FixedLengthDecrypt(RandomNumberGenerator &rng, const byte *cipherText, byte *plainText) const
{return Decrypt(rng, cipherText, FixedCiphertextLength(), plainText);} {return Decrypt(rng, cipherText, FixedCiphertextLength(), plainText);}
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~ElGamalObjectImpl() {}
#endif
protected: protected:
const DL_KeyAgreementAlgorithm<Integer> & GetKeyAgreementAlgorithm() const {return *this;} const DL_KeyAgreementAlgorithm<Integer> & GetKeyAgreementAlgorithm() const {return *this;}
const DL_KeyDerivationAlgorithm<Integer> & GetKeyDerivationAlgorithm() const {return *this;} const DL_KeyDerivationAlgorithm<Integer> & GetKeyDerivationAlgorithm() const {return *this;}
const DL_SymmetricEncryptionAlgorithm & GetSymmetricEncryptionAlgorithm() const {return *this;} const DL_SymmetricEncryptionAlgorithm & GetSymmetricEncryptionAlgorithm() const {return *this;}
}; };
//! \class ElGamalKeys
//! \brief ElGamal key agreement and encryption schemes keys
struct ElGamalKeys struct ElGamalKeys
{ {
typedef DL_CryptoKeys_GFP::GroupParameters GroupParameters; typedef DL_CryptoKeys_GFP::GroupParameters GroupParameters;
@ -123,6 +133,7 @@ struct ElGamalKeys
//! \class ElGamal //! \class ElGamal
//! \brief ElGamal encryption scheme with non-standard padding //! \brief ElGamal encryption scheme with non-standard padding
//! \since Crypto++ 1.0
struct ElGamal struct ElGamal
{ {
typedef DL_CryptoSchemeOptions<ElGamal, ElGamalKeys, int, int, int> SchemeOptions; typedef DL_CryptoSchemeOptions<ElGamal, ElGamalKeys, int, int, int> SchemeOptions;

View File

@ -436,6 +436,7 @@ public:
//! \brief DSA signature scheme //! \brief DSA signature scheme
//! \tparam H HashTransformation derived class //! \tparam H HashTransformation derived class
//! \sa <a href="http://www.weidai.com/scan-mirror/sig.html#DSA-1363">DSA-1363</a> //! \sa <a href="http://www.weidai.com/scan-mirror/sig.html#DSA-1363">DSA-1363</a>
//! \since Crypto++ 1.0 for DSA, Crypto++ 5.6.2 for DSA2
template <class H> template <class H>
struct GDSA : public DL_SS< struct GDSA : public DL_SS<
DL_SignatureKeys_GFP, DL_SignatureKeys_GFP,
@ -508,6 +509,7 @@ struct DL_Keys_DSA
//! \tparam H HashTransformation derived class //! \tparam H HashTransformation derived class
//! \details The class is named DSA2 instead of DSA for backwards compatibility because DSA was a non-template class. //! \details The class is named DSA2 instead of DSA for backwards compatibility because DSA was a non-template class.
//! \sa <a href="http://en.wikipedia.org/wiki/Digital_Signature_Algorithm">DSA</a>, as specified in FIPS 186-3 //! \sa <a href="http://en.wikipedia.org/wiki/Digital_Signature_Algorithm">DSA</a>, as specified in FIPS 186-3
//! \since Crypto++ 1.0 for DSA, Crypto++ 5.6.2 for DSA2
template <class H> template <class H>
class DSA2 : public DL_SS< class DSA2 : public DL_SS<
DL_Keys_DSA, DL_Keys_DSA,
@ -529,7 +531,7 @@ public:
}; };
//! DSA with SHA-1, typedef'd for backwards compatibility //! DSA with SHA-1, typedef'd for backwards compatibility
typedef DSA2<SHA> DSA; typedef DSA2<SHA1> DSA;
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_GFP<DL_GroupParameters_DSA>; CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_GFP<DL_GroupParameters_DSA>;
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_GFP<DL_GroupParameters_DSA>; CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_GFP<DL_GroupParameters_DSA>;

34
ida.h
View File

@ -1,7 +1,7 @@
// ida.h - written and placed in the public domain by Wei Dai // ida.h - written and placed in the public domain by Wei Dai
//! \file ida.h //! \file ida.h
//! \brief Classes for Information Dispersal Algorithm (IDA) //! \brief Classes for Rabin's Information Dispersal and Shamir's Secret Sharing algorithms
#ifndef CRYPTOPP_IDA_H #ifndef CRYPTOPP_IDA_H
#define CRYPTOPP_IDA_H #define CRYPTOPP_IDA_H
@ -16,7 +16,9 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
/// base class for secret sharing and information dispersal //! \class RawIDA
//! \brief Secret sharing and information dispersal base class
//! \since Crypto++ 1.0
class RawIDA : public AutoSignaling<Unflushable<Multichannel<Filter> > > class RawIDA : public AutoSignaling<Unflushable<Multichannel<Filter> > >
{ {
public: public:
@ -61,10 +63,15 @@ protected:
SecBlock<word32> m_u, m_w, m_y; SecBlock<word32> m_u, m_w, m_y;
}; };
/// a variant of Shamir's Secret Sharing Algorithm //! \class SecretSharing
//! \brief Shamir's Secret Sharing Algorithm
//! \details SecretSharing is a variant of Shamir's secret sharing algorithm
//! \sa SecretRecovery, SecretRecovery, InformationDispersal, InformationRecovery
//! \since Crypto++ 1.0
class SecretSharing : public CustomFlushPropagation<Filter> class SecretSharing : public CustomFlushPropagation<Filter>
{ {
public: public:
//! \brief Construct a SecretSharing
SecretSharing(RandomNumberGenerator &rng, int threshold, int nShares, BufferedTransformation *attachment=NULL, bool addPadding=true) SecretSharing(RandomNumberGenerator &rng, int threshold, int nShares, BufferedTransformation *attachment=NULL, bool addPadding=true)
: m_rng(rng), m_ida(new OutputProxy(*this, true)) : m_rng(rng), m_ida(new OutputProxy(*this, true))
{ {
@ -82,10 +89,15 @@ protected:
bool m_pad; bool m_pad;
}; };
/// a variant of Shamir's Secret Sharing Algorithm //! \class SecretRecovery
//! \brief Shamir's Secret Sharing Algorithm
//! \details SecretSharing is a variant of Shamir's secret sharing algorithm
//! \sa SecretRecovery, SecretRecovery, InformationDispersal, InformationRecovery
//! \since Crypto++ 1.0
class SecretRecovery : public RawIDA class SecretRecovery : public RawIDA
{ {
public: public:
//! \brief Construct a SecretRecovery
SecretRecovery(int threshold, BufferedTransformation *attachment=NULL, bool removePadding=true) SecretRecovery(int threshold, BufferedTransformation *attachment=NULL, bool removePadding=true)
: RawIDA(attachment) : RawIDA(attachment)
{IsolatedInitialize(MakeParameters("RecoveryThreshold", threshold)("RemovePadding", removePadding));} {IsolatedInitialize(MakeParameters("RecoveryThreshold", threshold)("RemovePadding", removePadding));}
@ -100,9 +112,16 @@ protected:
}; };
/// a variant of Rabin's Information Dispersal Algorithm /// a variant of Rabin's Information Dispersal Algorithm
//! \class InformationDispersal
//! \brief Rabin's Information Dispersal Algorithm
//! \details InformationDispersal is a variant of Rabin's information dispersal algorithm
//! \sa SecretRecovery, SecretRecovery, InformationDispersal, InformationRecovery
//! \since Crypto++ 1.0
class InformationDispersal : public CustomFlushPropagation<Filter> class InformationDispersal : public CustomFlushPropagation<Filter>
{ {
public: public:
//! \brief Construct a InformationDispersal
InformationDispersal(int threshold, int nShares, BufferedTransformation *attachment=NULL, bool addPadding=true) InformationDispersal(int threshold, int nShares, BufferedTransformation *attachment=NULL, bool addPadding=true)
: m_ida(new OutputProxy(*this, true)), m_pad(false), m_nextChannel(0) : m_ida(new OutputProxy(*this, true)), m_pad(false), m_nextChannel(0)
{ {
@ -120,10 +139,15 @@ protected:
unsigned int m_nextChannel; unsigned int m_nextChannel;
}; };
/// a variant of Rabin's Information Dispersal Algorithm //! \class InformationRecovery
//! \brief Rabin's Information Dispersal Algorithm
//! \details InformationDispersal is a variant of Rabin's information dispersal algorithm
//! \sa SecretRecovery, SecretRecovery, InformationDispersal, InformationRecovery
//! \since Crypto++ 1.0
class InformationRecovery : public RawIDA class InformationRecovery : public RawIDA
{ {
public: public:
//! \brief Construct a InformationRecovery
InformationRecovery(int threshold, BufferedTransformation *attachment=NULL, bool removePadding=true) InformationRecovery(int threshold, BufferedTransformation *attachment=NULL, bool removePadding=true)
: RawIDA(attachment), m_pad(false) : RawIDA(attachment), m_pad(false)
{IsolatedInitialize(MakeParameters("RecoveryThreshold", threshold)("RemovePadding", removePadding));} {IsolatedInitialize(MakeParameters("RecoveryThreshold", threshold)("RemovePadding", removePadding));}

2
idea.h
View File

@ -13,6 +13,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \class IDEA_Info //! \class IDEA_Info
//! \brief IDEA block cipher information //! \brief IDEA block cipher information
//! \since Crypto++ 1.0
struct IDEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public FixedRounds<8> struct IDEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public FixedRounds<8>
{ {
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "IDEA";} CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "IDEA";}
@ -21,6 +22,7 @@ struct IDEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public F
//! \class IDEA //! \class IDEA
//! \brief IDEA block cipher //! \brief IDEA block cipher
//! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#IDEA">IDEA</a> //! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#IDEA">IDEA</a>
//! \since Crypto++ 1.0
class IDEA : public IDEA_Info, public BlockCipherDocumentation class IDEA : public IDEA_Info, public BlockCipherDocumentation
{ {
public: // made public for internal purposes public: // made public for internal purposes

5
md5.h
View File

@ -7,7 +7,10 @@ NAMESPACE_BEGIN(CryptoPP)
namespace Weak1 { namespace Weak1 {
//! <a href="http://www.cryptolounge.org/wiki/MD5">MD5</a> //! \class MD5
//! \brief MD5 message digest
//! \sa <a href="http://www.cryptolounge.org/wiki/MD5">MD5</a>
//! \since Crypto++ 1.0
class MD5 : public IteratedHashWithStaticTransform<word32, LittleEndian, 64, 16, MD5> class MD5 : public IteratedHashWithStaticTransform<word32, LittleEndian, 64, 16, MD5>
{ {
public: public:

2
rc5.h
View File

@ -13,6 +13,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \class RC5_Info //! \class RC5_Info
//! \brief RC5 block cipher information //! \brief RC5 block cipher information
//! \since Crypto++ 1.0
struct RC5_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 0, 255>, public VariableRounds<16> struct RC5_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 0, 255>, public VariableRounds<16>
{ {
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "RC5";} CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "RC5";}
@ -22,6 +23,7 @@ struct RC5_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 0, 255>
//! \class RC5 //! \class RC5
//! \brief RC5 block cipher //! \brief RC5 block cipher
//! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#RC5">RC5</a> //! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#RC5">RC5</a>
//! \since Crypto++ 1.0
class RC5 : public RC5_Info, public BlockCipherDocumentation class RC5 : public RC5_Info, public BlockCipherDocumentation
{ {
class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<RC5_Info> class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<RC5_Info>

15
rsa.h
View File

@ -20,6 +20,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \class RSAFunction //! \class RSAFunction
//! \brief RSA trapdoor function using the public key //! \brief RSA trapdoor function using the public key
//! \since Crypto++ 1.0
class CRYPTOPP_DLL RSAFunction : public TrapdoorFunction, public X509PublicKey class CRYPTOPP_DLL RSAFunction : public TrapdoorFunction, public X509PublicKey
{ {
typedef RSAFunction ThisClass; typedef RSAFunction ThisClass;
@ -59,6 +60,7 @@ protected:
//! \class InvertibleRSAFunction //! \class InvertibleRSAFunction
//! \brief RSA trapdoor function using the private key //! \brief RSA trapdoor function using the private key
//! \since Crypto++ 1.0
class CRYPTOPP_DLL InvertibleRSAFunction : public RSAFunction, public TrapdoorFunctionInverse, public PKCS8PrivateKey class CRYPTOPP_DLL InvertibleRSAFunction : public RSAFunction, public TrapdoorFunctionInverse, public PKCS8PrivateKey
{ {
typedef InvertibleRSAFunction ThisClass; typedef InvertibleRSAFunction ThisClass;
@ -132,6 +134,7 @@ protected:
//! \class RSAFunction_ISO //! \class RSAFunction_ISO
//! \brief RSA trapdoor function using the public key //! \brief RSA trapdoor function using the public key
//! \since Crypto++ 1.0
class CRYPTOPP_DLL RSAFunction_ISO : public RSAFunction class CRYPTOPP_DLL RSAFunction_ISO : public RSAFunction
{ {
public: public:
@ -141,6 +144,7 @@ public:
//! \class InvertibleRSAFunction_ISO //! \class InvertibleRSAFunction_ISO
//! \brief RSA trapdoor function using the private key //! \brief RSA trapdoor function using the private key
//! \since Crypto++ 1.0
class CRYPTOPP_DLL InvertibleRSAFunction_ISO : public InvertibleRSAFunction class CRYPTOPP_DLL InvertibleRSAFunction_ISO : public InvertibleRSAFunction
{ {
public: public:
@ -150,6 +154,7 @@ public:
//! \class RSA //! \class RSA
//! \brief RSA algorithm //! \brief RSA algorithm
//! \since Crypto++ 1.0
struct CRYPTOPP_DLL RSA struct CRYPTOPP_DLL RSA
{ {
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "RSA";} CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "RSA";}
@ -161,6 +166,7 @@ struct CRYPTOPP_DLL RSA
//! \brief RSA encryption algorithm //! \brief RSA encryption algorithm
//! \tparam STANDARD signature standard //! \tparam STANDARD signature standard
//! \sa <a href="http://www.weidai.com/scan-mirror/ca.html#RSA">RSA cryptosystem</a> //! \sa <a href="http://www.weidai.com/scan-mirror/ca.html#RSA">RSA cryptosystem</a>
//! \since Crypto++ 1.0
template <class STANDARD> template <class STANDARD>
struct RSAES : public TF_ES<STANDARD, RSA> struct RSAES : public TF_ES<STANDARD, RSA>
{ {
@ -172,6 +178,7 @@ struct RSAES : public TF_ES<STANDARD, RSA>
//! \tparam H hash transformation //! \tparam H hash transformation
//! \details See documentation of PKCS1v15 for a list of hash functions that can be used with it. //! \details See documentation of PKCS1v15 for a list of hash functions that can be used with it.
//! \sa <a href="http://www.weidai.com/scan-mirror/sig.html#RSA">RSA signature scheme with appendix</a> //! \sa <a href="http://www.weidai.com/scan-mirror/sig.html#RSA">RSA signature scheme with appendix</a>
//! \since Crypto++ 1.0
template <class STANDARD, class H> template <class STANDARD, class H>
struct RSASS : public TF_SS<STANDARD, H, RSA> struct RSASS : public TF_SS<STANDARD, H, RSA>
{ {
@ -179,6 +186,7 @@ struct RSASS : public TF_SS<STANDARD, H, RSA>
//! \class RSA_ISO //! \class RSA_ISO
//! \brief RSA algorithm //! \brief RSA algorithm
//! \since Crypto++ 1.0
struct CRYPTOPP_DLL RSA_ISO struct CRYPTOPP_DLL RSA_ISO
{ {
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "RSA-ISO";} CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "RSA-ISO";}
@ -189,6 +197,7 @@ struct CRYPTOPP_DLL RSA_ISO
//! \class RSASS_ISO //! \class RSASS_ISO
//! \brief RSA signature algorithm //! \brief RSA signature algorithm
//! \tparam H hash transformation //! \tparam H hash transformation
//! \since Crypto++ 1.0
template <class H> template <class H>
struct RSASS_ISO : public TF_SS<P1363_EMSA2, H, RSA_ISO> struct RSASS_ISO : public TF_SS<P1363_EMSA2, H, RSA_ISO>
{ {
@ -211,25 +220,31 @@ DOCUMENTED_TYPEDEF(RSAES<OAEP<SHA> >::Encryptor, RSAES_OAEP_SHA_Encryptor);
#ifdef CRYPTOPP_DOXYGEN_PROCESSING #ifdef CRYPTOPP_DOXYGEN_PROCESSING
//! \brief \ref RSASS<STANDARD,HASH> "RSASS<PKCS1v15,SHA>::Signer" typedef //! \brief \ref RSASS<STANDARD,HASH> "RSASS<PKCS1v15,SHA>::Signer" typedef
//! \details RSA signature schemes defined in PKCS #1 v2.0 //! \details RSA signature schemes defined in PKCS #1 v2.0
//! \since Crypto++ 1.0
class RSASSA_PKCS1v15_SHA_Signer : public RSASS<PKCS1v15,SHA>::Signer {}; class RSASSA_PKCS1v15_SHA_Signer : public RSASS<PKCS1v15,SHA>::Signer {};
//! \brief \ref RSASS<STANDARD,HASH> "RSASS<PKCS1v15,SHA>::Verifier" typedef //! \brief \ref RSASS<STANDARD,HASH> "RSASS<PKCS1v15,SHA>::Verifier" typedef
//! \details RSA signature schemes defined in PKCS #1 v2.0 //! \details RSA signature schemes defined in PKCS #1 v2.0
//! \since Crypto++ 1.0
class RSASSA_PKCS1v15_SHA_Verifier : public RSASS<PKCS1v15,SHA>::Verifier {}; class RSASSA_PKCS1v15_SHA_Verifier : public RSASS<PKCS1v15,SHA>::Verifier {};
namespace Weak { namespace Weak {
//! \brief \ref RSASS<STANDARD,HASH> "RSASS<PKCS1v15, Weak::MD2>::Signer" typedef //! \brief \ref RSASS<STANDARD,HASH> "RSASS<PKCS1v15, Weak::MD2>::Signer" typedef
//! \details RSA signature schemes defined in PKCS #1 v2.0 //! \details RSA signature schemes defined in PKCS #1 v2.0
//! \since Crypto++ 1.0
class RSASSA_PKCS1v15_MD2_Signer : public RSASS<PKCS1v15, Weak1::MD2>::Signer {}; class RSASSA_PKCS1v15_MD2_Signer : public RSASS<PKCS1v15, Weak1::MD2>::Signer {};
//! \brief \ref RSASS<STANDARD,HASH> "RSASS<PKCS1v15, Weak::MD2>::Verifier" typedef //! \brief \ref RSASS<STANDARD,HASH> "RSASS<PKCS1v15, Weak::MD2>::Verifier" typedef
//! \details RSA signature schemes defined in PKCS #1 v2.0 //! \details RSA signature schemes defined in PKCS #1 v2.0
//! \since Crypto++ 1.0
class RSASSA_PKCS1v15_MD2_Verifier : public RSASS<PKCS1v15, Weak1::MD2>::Verifier {}; class RSASSA_PKCS1v15_MD2_Verifier : public RSASS<PKCS1v15, Weak1::MD2>::Verifier {};
//! \brief \ref RSASS<STANDARD,HASH> "RSASS<PKCS1v15, Weak::MD5>::Signer" typedef //! \brief \ref RSASS<STANDARD,HASH> "RSASS<PKCS1v15, Weak::MD5>::Signer" typedef
//! \details RSA signature schemes defined in PKCS #1 v2.0 //! \details RSA signature schemes defined in PKCS #1 v2.0
//! \since Crypto++ 1.0
class RSASSA_PKCS1v15_MD5_Signer : public RSASS<PKCS1v15, Weak1::MD5>::Signer {}; class RSASSA_PKCS1v15_MD5_Signer : public RSASS<PKCS1v15, Weak1::MD5>::Signer {};
//! \brief \ref RSASS<STANDARD,HASH> "RSASS<PKCS1v15, Weak::MD5>::Verifier" typedef //! \brief \ref RSASS<STANDARD,HASH> "RSASS<PKCS1v15, Weak::MD5>::Verifier" typedef
//! \details RSA signature schemes defined in PKCS #1 v2.0 //! \details RSA signature schemes defined in PKCS #1 v2.0
//! \since Crypto++ 1.0
class RSASSA_PKCS1v15_MD5_Verifier : public RSASS<PKCS1v15, Weak1::MD5>::Verifier {}; class RSASSA_PKCS1v15_MD5_Verifier : public RSASS<PKCS1v15, Weak1::MD5>::Verifier {};
} }

25
sha.h
View File

@ -18,7 +18,10 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
/// <a href="http://www.weidai.com/scan-mirror/md.html#SHA-1">SHA-1</a> //! \class SHA1
//! \brief SHA-1 message digest
//! \sa <a href="http://www.weidai.com/scan-mirror/md.html#SHA-1">SHA-1</a>
//! \since Crypto++ 1.0
class CRYPTOPP_DLL SHA1 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 20, SHA1> class CRYPTOPP_DLL SHA1 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 20, SHA1>
{ {
public: public:
@ -29,7 +32,10 @@ public:
typedef SHA1 SHA; // for backwards compatibility typedef SHA1 SHA; // for backwards compatibility
//! implements the SHA-256 standard //! \class SHA256
//! \brief SHA-256 message digest
//! \sa <a href="http://www.weidai.com/scan-mirror/md.html#SHA-256">SHA-256</a>
//! \since Crypto++ 4.0
class CRYPTOPP_DLL SHA256 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA256, 32, true> class CRYPTOPP_DLL SHA256 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA256, 32, true>
{ {
public: public:
@ -41,7 +47,10 @@ public:
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-256";} CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-256";}
}; };
//! implements the SHA-224 standard //! \class SHA224
//! \brief SHA-224 message digest
//! \sa <a href="http://www.weidai.com/scan-mirror/md.html#SHA-224">SHA-224</a>
//! \since Crypto++ 4.0
class CRYPTOPP_DLL SHA224 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA224, 28, true> class CRYPTOPP_DLL SHA224 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA224, 28, true>
{ {
public: public:
@ -53,7 +62,10 @@ public:
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-224";} CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-224";}
}; };
//! implements the SHA-512 standard //! \class SHA512
//! \brief SHA-512 message digest
//! \sa <a href="http://www.weidai.com/scan-mirror/md.html#SHA-512">SHA-512</a>
//! \since Crypto++ 4.0
class CRYPTOPP_DLL SHA512 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA512, 64, (CRYPTOPP_BOOL_X86|CRYPTOPP_BOOL_X32)> class CRYPTOPP_DLL SHA512 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA512, 64, (CRYPTOPP_BOOL_X86|CRYPTOPP_BOOL_X32)>
{ {
public: public:
@ -62,7 +74,10 @@ public:
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-512";} CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-512";}
}; };
//! implements the SHA-384 standard //! \class SHA384
//! \brief SHA-384 message digest
//! \sa <a href="http://www.weidai.com/scan-mirror/md.html#SHA-384">SHA-384</a>
//! \since Crypto++ 4.0
class CRYPTOPP_DLL SHA384 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA384, 48, (CRYPTOPP_BOOL_X86|CRYPTOPP_BOOL_X32)> class CRYPTOPP_DLL SHA384 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA384, 48, (CRYPTOPP_BOOL_X86|CRYPTOPP_BOOL_X32)>
{ {
public: public:

3
wake.h
View File

@ -15,6 +15,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \class WAKE_OFB_Info //! \class WAKE_OFB_Info
//! \brief WAKE stream cipher information //! \brief WAKE stream cipher information
//! \tparam B Endianess of the stream cipher //! \tparam B Endianess of the stream cipher
//! \since Crypto++ 1.0
template <class B = BigEndian> template <class B = BigEndian>
struct WAKE_OFB_Info : public FixedKeyLength<32> struct WAKE_OFB_Info : public FixedKeyLength<32>
{ {
@ -34,6 +35,7 @@ protected:
//! \class WAKE_Policy //! \class WAKE_Policy
//! \brief WAKE stream cipher operation //! \brief WAKE stream cipher operation
//! \tparam B Endianess of the stream cipher //! \tparam B Endianess of the stream cipher
//! \since Crypto++ 1.0
template <class B = BigEndian> template <class B = BigEndian>
class CRYPTOPP_NO_VTABLE WAKE_Policy : public AdditiveCipherConcretePolicy<word32, 1, 64>, protected WAKE_Base class CRYPTOPP_NO_VTABLE WAKE_Policy : public AdditiveCipherConcretePolicy<word32, 1, 64>, protected WAKE_Base
{ {
@ -47,6 +49,7 @@ protected:
//! \class WAKE_OFB //! \class WAKE_OFB
//! \brief WAKE stream cipher //! \brief WAKE stream cipher
//! \tparam B Endianess of the stream cipher //! \tparam B Endianess of the stream cipher
//! \since Crypto++ 1.0
template <class B = BigEndian> template <class B = BigEndian>
struct WAKE_OFB : public WAKE_OFB_Info<B>, public SymmetricCipherDocumentation struct WAKE_OFB : public WAKE_OFB_Info<B>, public SymmetricCipherDocumentation
{ {

View File

@ -12,7 +12,9 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
//! \class LowFirstBitWriter
//! \brief Encoding table writer //! \brief Encoding table writer
//! \since Crypto++ 1.0
class LowFirstBitWriter : public Filter class LowFirstBitWriter : public Filter
{ {
public: public:
@ -36,6 +38,8 @@ protected:
}; };
//! \class HuffmanEncoder //! \class HuffmanEncoder
//! \brief Huffman Encoder
//! \since Crypto++ 1.0
class HuffmanEncoder class HuffmanEncoder
{ {
public: public:
@ -70,6 +74,7 @@ public:
//! \class Deflator //! \class Deflator
//! \brief DEFLATE compressor (RFC 1951) //! \brief DEFLATE compressor (RFC 1951)
//! \since Crypto++ 1.0
class Deflator : public LowFirstBitWriter class Deflator : public LowFirstBitWriter
{ {
public: public:

View File

@ -8,7 +8,8 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
//! _ //! \class LowFirstBitReader
//! \since Crypto++ 1.0
class LowFirstBitReader class LowFirstBitReader
{ {
public: public:
@ -29,7 +30,9 @@ private:
struct CodeLessThan; struct CodeLessThan;
//! Huffman Decoder //! \class HuffmanDecoder
//! \brief Huffman Decoder
//! \since Crypto++ 1.0
class HuffmanDecoder class HuffmanDecoder
{ {
public: public:
@ -83,8 +86,9 @@ private:
mutable std::vector<LookupEntry, AllocatorWithCleanup<LookupEntry> > m_cache; mutable std::vector<LookupEntry, AllocatorWithCleanup<LookupEntry> > m_cache;
}; };
//! DEFLATE (RFC 1951) decompressor //! \class Inflator
//! \brief DEFLATE decompressor (RFC 1951)
//! \since Crypto++ 1.0
class Inflator : public AutoSignaling<Filter> class Inflator : public AutoSignaling<Filter>
{ {
public: public: