diff options
Diffstat (limited to 'src/block/lubyrack/lubyrack.cpp')
-rw-r--r-- | src/block/lubyrack/lubyrack.cpp | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/src/block/lubyrack/lubyrack.cpp b/src/block/lubyrack/lubyrack.cpp index 5304d14d6..a9d2b1db2 100644 --- a/src/block/lubyrack/lubyrack.cpp +++ b/src/block/lubyrack/lubyrack.cpp @@ -1,16 +1,18 @@ -/************************************************* -* Luby-Rackoff Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Luby-Rackoff +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/lubyrack.h> #include <botan/xor_buf.h> namespace Botan { -/************************************************* -* Luby-Rackoff Encryption * -*************************************************/ +/* +* Luby-Rackoff Encryption +*/ void LubyRackoff::enc(const byte in[], byte out[]) const { const u32bit len = hash->OUTPUT_LENGTH; @@ -37,9 +39,9 @@ void LubyRackoff::enc(const byte in[], byte out[]) const xor_buf(out, buffer, len); } -/************************************************* -* Luby-Rackoff Decryption * -*************************************************/ +/* +* Luby-Rackoff Decryption +*/ void LubyRackoff::dec(const byte in[], byte out[]) const { const u32bit len = hash->OUTPUT_LENGTH; @@ -66,18 +68,18 @@ void LubyRackoff::dec(const byte in[], byte out[]) const xor_buf(out + len, buffer, len); } -/************************************************* -* Luby-Rackoff Key Schedule * -*************************************************/ +/* +* Luby-Rackoff Key Schedule +*/ void LubyRackoff::key_schedule(const byte key[], u32bit length) { K1.set(key, length / 2); K2.set(key + length / 2, length / 2); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void LubyRackoff::clear() throw() { K1.clear(); @@ -85,25 +87,25 @@ void LubyRackoff::clear() throw() hash->clear(); } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ BlockCipher* LubyRackoff::clone() const { return new LubyRackoff(hash->clone()); } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string LubyRackoff::name() const { return "Luby-Rackoff(" + hash->name() + ")"; } -/************************************************* -* Luby-Rackoff Constructor * -*************************************************/ +/* +* Luby-Rackoff Constructor +*/ LubyRackoff::LubyRackoff(HashFunction* h) : BlockCipher(2 * (h ? h->OUTPUT_LENGTH: 0), 2, 32, 2), |