6 #ifndef CRYPTOPP_LUBYRACK_H 7 #define CRYPTOPP_LUBYRACK_H 18 static std::string StaticAlgorithmName() {
return std::string(
"LR/")+T::StaticAlgorithmName();}
29 void UncheckedSetKey(
const byte *userKey,
unsigned int length,
const NameValuePairs ¶ms)
31 this->AssertValidKeyLength(length);
36 key.Assign(userKey, 2*L);
40 CRYPTOPP_CONSTANT(S=T::DIGESTSIZE)
48 class CRYPTOPP_NO_VTABLE Enc :
public Base
53 #define KR this->key+this->L 54 #define BL this->buffer 55 #define BR this->buffer+this->S 57 #define IR inBlock+this->S 59 #define OR outBlock+this->S 61 void ProcessAndXorBlock(
const byte *inBlock,
const byte *xorBlock, byte *outBlock)
const 63 this->hm.Update(KL, this->L);
64 this->hm.Update(IL, this->S);
68 this->hm.Update(KR, this->L);
69 this->hm.Update(BR, this->S);
73 this->hm.Update(KL, this->L);
74 this->hm.Update(BL, this->S);
75 this->hm.Final(this->digest);
76 xorbuf(BR, this->digest, this->S);
78 this->hm.Update(KR, this->L);
79 this->hm.Update(OR, this->S);
80 this->hm.Final(this->digest);
81 xorbuf(BL, this->digest, this->S);
84 xorbuf(outBlock, xorBlock, this->buffer, 2*this->S);
86 memcpy_s(outBlock, 2*this->S, this->buffer, 2*this->S);
90 class CRYPTOPP_NO_VTABLE Dec :
public Base
93 void ProcessAndXorBlock(
const byte *inBlock,
const byte *xorBlock, byte *outBlock)
const 95 this->hm.Update(KR, this->L);
96 this->hm.Update(IR, this->S);
100 this->hm.Update(KL, this->L);
101 this->hm.Update(BL, this->S);
105 this->hm.Update(KR, this->L);
106 this->hm.Update(BR, this->S);
107 this->hm.Final(this->digest);
108 xorbuf(BL, this->digest, this->S);
110 this->hm.Update(KL, this->L);
111 this->hm.Update(OL, this->S);
112 this->hm.Final(this->digest);
113 xorbuf(BR, this->digest, this->S);
116 xorbuf(outBlock, xorBlock, this->buffer, 2*this->S);
118 memcpy(outBlock, this->buffer, 2*this->S);
Classes providing basic library services.
Luby-Rackoff block cipher information.
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()
Classes and functions for secure memory allocations.
Inherited by algorithms 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 a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Crypto++ library namespace.
Luby-Rackoff block cipher.
Interface for retrieving values given their names.