6 #ifndef CRYPTOPP_LUBYRACK_H 7 #define CRYPTOPP_LUBYRACK_H 16 CRYPTOPP_CONSTANT(RESULT = 2*T::DIGESTSIZE)
23 static std::string StaticAlgorithmName() {
return std::string(
"LR/")+T::StaticAlgorithmName();}
34 void UncheckedSetKey(
const byte *userKey,
unsigned int length,
const NameValuePairs ¶ms)
36 this->AssertValidKeyLength(length);
41 key.Assign(userKey, 2*L);
45 CRYPTOPP_CONSTANT(S=T::DIGESTSIZE)
53 class CRYPTOPP_NO_VTABLE Enc :
public Base
58 #define KR this->key+this->L 59 #define BL this->buffer 60 #define BR this->buffer+this->S 62 #define IR inBlock+this->S 64 #define OR outBlock+this->S 66 void ProcessAndXorBlock(
const byte *inBlock,
const byte *xorBlock, byte *outBlock)
const 68 this->hm.Update(KL, this->L);
69 this->hm.Update(IL, this->S);
73 this->hm.Update(KR, this->L);
74 this->hm.Update(BR, this->S);
78 this->hm.Update(KL, this->L);
79 this->hm.Update(BL, this->S);
80 this->hm.Final(this->digest);
81 xorbuf(BR, this->digest, this->S);
83 this->hm.Update(KR, this->L);
84 this->hm.Update(OR, this->S);
85 this->hm.Final(this->digest);
86 xorbuf(BL, this->digest, this->S);
89 xorbuf(outBlock, xorBlock, this->buffer, 2*this->S);
91 memcpy_s(outBlock, 2*this->S, this->buffer, 2*this->S);
95 class CRYPTOPP_NO_VTABLE Dec :
public Base
98 void ProcessAndXorBlock(
const byte *inBlock,
const byte *xorBlock, byte *outBlock)
const 100 this->hm.Update(KR, this->L);
101 this->hm.Update(IR, this->S);
105 this->hm.Update(KL, this->L);
106 this->hm.Update(BL, this->S);
110 this->hm.Update(KR, this->L);
111 this->hm.Update(BR, this->S);
112 this->hm.Final(this->digest);
113 xorbuf(BL, this->digest, this->S);
115 this->hm.Update(KL, this->L);
116 this->hm.Update(OL, this->S);
117 this->hm.Final(this->digest);
118 xorbuf(BR, this->digest, this->S);
121 xorbuf(outBlock, xorBlock, this->buffer, 2*this->S);
123 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.