Warning, file /include/cryptopp/rabbit.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef CRYPTOPP_RABBIT_H
0016 #define CRYPTOPP_RABBIT_H
0017
0018 #include "strciphr.h"
0019 #include "secblock.h"
0020
0021
0022
0023
0024
0025 NAMESPACE_BEGIN(CryptoPP)
0026
0027
0028
0029 struct RabbitInfo : public FixedKeyLength<16, SimpleKeyingInterface::NOT_RESYNCHRONIZABLE>
0030 {
0031 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() { return "Rabbit"; }
0032 };
0033
0034
0035
0036 struct RabbitWithIVInfo : public FixedKeyLength<16, SimpleKeyingInterface::UNIQUE_IV, 8>
0037 {
0038 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() { return "RabbitWithIV"; }
0039 };
0040
0041
0042
0043 class RabbitPolicy : public AdditiveCipherConcretePolicy<word32, 4>, public RabbitInfo
0044 {
0045 protected:
0046 void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
0047 void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
0048 bool CanOperateKeystream() const { return true; }
0049 bool CipherIsRandomAccess() const { return false; }
0050
0051 private:
0052
0053 FixedSizeSecBlock<word32, 8> m_mx, m_mc, m_wx, m_wc;
0054
0055 FixedSizeSecBlock<word32, 12> m_t;
0056 word32 m_mcy, m_wcy;
0057 };
0058
0059
0060
0061 class RabbitWithIVPolicy : public AdditiveCipherConcretePolicy<word32, 4>, public RabbitWithIVInfo
0062 {
0063 protected:
0064 void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
0065 void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
0066 void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length);
0067 bool CanOperateKeystream() const { return true; }
0068 bool CipherIsRandomAccess() const { return false; }
0069
0070 private:
0071
0072 FixedSizeSecBlock<word32, 8> m_mx, m_mc, m_wx, m_wc;
0073
0074 FixedSizeSecBlock<word32, 12> m_t;
0075 word32 m_mcy, m_wcy;
0076 };
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088 struct Rabbit : public RabbitInfo, public SymmetricCipherDocumentation
0089 {
0090 typedef SymmetricCipherFinal<ConcretePolicyHolder<RabbitPolicy, AdditiveCipherTemplate<> >, RabbitInfo> Encryption;
0091 typedef Encryption Decryption;
0092 };
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104 struct RabbitWithIV : public RabbitWithIVInfo, public SymmetricCipherDocumentation
0105 {
0106 typedef SymmetricCipherFinal<ConcretePolicyHolder<RabbitWithIVPolicy, AdditiveCipherTemplate<> >, RabbitWithIVInfo> Encryption;
0107 typedef Encryption Decryption;
0108 };
0109
0110 NAMESPACE_END
0111
0112 #endif