6 #ifndef CRYPTOPP_LUBYRACK_H 7 #define CRYPTOPP_LUBYRACK_H 18 CRYPTOPP_CONSTANT(RESULT = 2*T::DIGESTSIZE)
25 static std::string StaticAlgorithmName() {
return std::string(
"LR/")+T::StaticAlgorithmName();}
36 void UncheckedSetKey(
const byte *userKey,
unsigned int length,
const NameValuePairs ¶ms)
38 this->AssertValidKeyLength(length);
43 key.Assign(userKey, 2*L);
47 CRYPTOPP_CONSTANT(S=T::DIGESTSIZE)
55 class CRYPTOPP_NO_VTABLE Enc :
public Base
60 #define KR this->key+this->L 61 #define BL this->buffer 62 #define BR this->buffer+this->S 64 #define IR inBlock+this->S 66 #define OR outBlock+this->S 68 void ProcessAndXorBlock(
const byte *inBlock,
const byte *xorBlock, byte *outBlock)
const 70 this->hm.Update(KL, this->L);
71 this->hm.Update(IL, this->S);
75 this->hm.Update(KR, this->L);
76 this->hm.Update(BR, this->S);
80 this->hm.Update(KL, this->L);
81 this->hm.Update(BL, this->S);
82 this->hm.Final(this->digest);
83 xorbuf(BR, this->digest, this->S);
85 this->hm.Update(KR, this->L);
86 this->hm.Update(OR, this->S);
87 this->hm.Final(this->digest);
88 xorbuf(BL, this->digest, this->S);
91 xorbuf(outBlock, xorBlock, this->buffer, 2*this->S);
93 memcpy_s(outBlock, 2*this->S, this->buffer, 2*this->S);
97 class CRYPTOPP_NO_VTABLE Dec :
public Base
100 void ProcessAndXorBlock(
const byte *inBlock,
const byte *xorBlock, byte *outBlock)
const 102 this->hm.Update(KR, this->L);
103 this->hm.Update(IR, this->S);
107 this->hm.Update(KL, this->L);
108 this->hm.Update(BL, this->S);
112 this->hm.Update(KR, this->L);
113 this->hm.Update(BR, this->S);
114 this->hm.Final(this->digest);
115 xorbuf(BL, this->digest, this->S);
117 this->hm.Update(KL, this->L);
118 this->hm.Update(OL, this->S);
119 this->hm.Final(this->digest);
120 xorbuf(BR, this->digest, this->S);
123 xorbuf(outBlock, xorBlock, this->buffer, 2*this->S);
125 memcpy(outBlock, this->buffer, 2*this->S);
Classes providing simple keying interfaces.
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher...
void memcpy_s(void *dest, size_t sizeInBytes, const void *src, size_t count)
Bounds checking replacement for memcpy()
SecByteBlock is a SecBlock<byte> typedef.
Classes and functions for secure memory allocations.
Inherited by block ciphers with fixed block size.
Inherited by keyed algorithms with variable key length.
void xorbuf(byte *buf, const byte *mask, size_t count)
Performs an XOR of a buffer with a mask.
Provides class member functions to access BlockCipher constants.
Crypto++ library namespace.
Interface for retrieving values given their names.