8
8
NAMESPACE_BEGIN(CryptoPP)
11
struct Salsa20_Info : public VariableKeyLength<32, 16, 32, 16, SimpleKeyingInterface::STRUCTURED_IV>
11
struct Salsa20_Info : public VariableKeyLength<32, 16, 32, 16, SimpleKeyingInterface::UNIQUE_IV, 8>
13
13
static const char *StaticAlgorithmName() {return "Salsa20";}
16
class CRYPTOPP_NO_VTABLE Salsa20_Policy : public AdditiveCipherConcretePolicy<word32, 16>, public Salsa20_Info
16
class CRYPTOPP_NO_VTABLE Salsa20_Policy : public AdditiveCipherConcretePolicy<word32, 16>
19
unsigned int IVSize() const {return 8;}
20
void GetNextIV(byte *IV) const;
23
19
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
24
20
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
25
void CipherResynchronize(byte *keystreamBuffer, const byte *IV);
26
bool IsRandomAccess() const {return true;}
21
void CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length);
22
bool CipherIsRandomAccess() const {return true;}
27
23
void SeekToIteration(lword iterationCount);
24
#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X64
25
unsigned int GetAlignment() const;
26
unsigned int GetOptimalBlockSize() const;
29
FixedSizeAlignedSecBlock<word32, 16> m_state;
31
FixedSizeSecBlock<word32, 16> m_state;
34
//! Salsa20, variable rounds: 8, 12 or 20 (default 20)
33
/// <a href="http://www.cryptolounge.org/wiki/Salsa20">Salsa20</a>, variable rounds: 8, 12 or 20 (default 20)
35
34
struct Salsa20 : public Salsa20_Info, public SymmetricCipherDocumentation
37
36
typedef SymmetricCipherFinal<ConcretePolicyHolder<Salsa20_Policy, AdditiveCipherTemplate<> >, Salsa20_Info> Encryption;
38
37
typedef Encryption Decryption;
41
struct XSalsa20_Info : public FixedKeyLength<32, SimpleKeyingInterface::UNIQUE_IV, 24>
43
static const char *StaticAlgorithmName() {return "XSalsa20";}
46
class CRYPTOPP_NO_VTABLE XSalsa20_Policy : public Salsa20_Policy
49
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
50
void CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length);
53
FixedSizeSecBlock<word32, 8> m_key;
56
/// <a href="http://www.cryptolounge.org/wiki/XSalsa20">XSalsa20</a>, variable rounds: 8, 12 or 20 (default 20)
57
struct XSalsa20 : public XSalsa20_Info, public SymmetricCipherDocumentation
59
typedef SymmetricCipherFinal<ConcretePolicyHolder<XSalsa20_Policy, AdditiveCipherTemplate<> >, XSalsa20_Info> Encryption;
60
typedef Encryption Decryption;