aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/des/des.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-03-30 18:27:18 +0000
committerlloyd <[email protected]>2009-03-30 18:27:18 +0000
commit96d6eb6f29c55e16a37cf11899547886f735b065 (patch)
tree9f13901e9b44c98d58b2589c9b09c6a7443eb7cd /src/block/des/des.cpp
parent3cc3dd72c5f87b76852a55c1f2d1821dba967d8c (diff)
Thomas Moschny passed along a request from the Fedora packagers which came
up during the Fedora submission review, that each source file include some text about the license. One handy Perl script later and each file now has the line Distributed under the terms of the Botan license after the copyright notices. While I was in there modifying every file anyway, I also stripped out the remainder of the block comments (lots of astericks before and after the text); this is stylistic thing I picked up when I was first learning C++ but in retrospect it is not a good style as the structure makes it harder to modify comments (with the result that comments become fewer, shorter and are less likely to be updated, which are not good things).
Diffstat (limited to 'src/block/des/des.cpp')
-rw-r--r--src/block/des/des.cpp64
1 files changed, 33 insertions, 31 deletions
diff --git a/src/block/des/des.cpp b/src/block/des/des.cpp
index f6453cff0..37520e0fc 100644
--- a/src/block/des/des.cpp
+++ b/src/block/des/des.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* DES Source File *
-* (C) 1999-2008 Jack Lloyd *
-*************************************************/
+/*
+* DES
+* (C) 1999-2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/des.h>
#include <botan/loadstor.h>
@@ -10,9 +12,9 @@ namespace Botan {
namespace {
-/*************************************************
-* DES Key Schedule *
-*************************************************/
+/*
+* DES Key Schedule
+*/
void des_key_schedule(u32bit round_key[32], const byte key[8])
{
static const byte ROT[16] = { 1, 1, 2, 2, 2, 2, 2, 2,
@@ -76,9 +78,9 @@ void des_key_schedule(u32bit round_key[32], const byte key[8])
}
}
-/*************************************************
-* DES Encryption *
-*************************************************/
+/*
+* DES Encryption
+*/
void des_encrypt(u32bit& L, u32bit& R,
const u32bit round_key[32])
{
@@ -104,9 +106,9 @@ void des_encrypt(u32bit& L, u32bit& R,
}
}
-/*************************************************
-* DES Decryption *
-*************************************************/
+/*
+* DES Decryption
+*/
void des_decrypt(u32bit& L, u32bit& R,
const u32bit round_key[32])
{
@@ -134,9 +136,9 @@ void des_decrypt(u32bit& L, u32bit& R,
}
-/*************************************************
-* DES Encryption *
-*************************************************/
+/*
+* DES Encryption
+*/
void DES::enc(const byte in[], byte out[]) const
{
u64bit T = (DES_IPTAB1[in[0]] ) | (DES_IPTAB1[in[1]] << 1) |
@@ -159,9 +161,9 @@ void DES::enc(const byte in[], byte out[]) const
store_be(T, out);
}
-/*************************************************
-* DES Decryption *
-*************************************************/
+/*
+* DES Decryption
+*/
void DES::dec(const byte in[], byte out[]) const
{
u64bit T = (DES_IPTAB1[in[0]] ) | (DES_IPTAB1[in[1]] << 1) |
@@ -184,17 +186,17 @@ void DES::dec(const byte in[], byte out[]) const
store_be(T, out);
}
-/*************************************************
-* DES Key Schedule *
-*************************************************/
+/*
+* DES Key Schedule
+*/
void DES::key_schedule(const byte key[], u32bit)
{
des_key_schedule(round_key.begin(), key);
}
-/*************************************************
-* TripleDES Encryption *
-*************************************************/
+/*
+* TripleDES Encryption
+*/
void TripleDES::enc(const byte in[], byte out[]) const
{
u64bit T = (DES_IPTAB1[in[0]] ) | (DES_IPTAB1[in[1]] << 1) |
@@ -219,9 +221,9 @@ void TripleDES::enc(const byte in[], byte out[]) const
store_be(T, out);
}
-/*************************************************
-* TripleDES Decryption *
-*************************************************/
+/*
+* TripleDES Decryption
+*/
void TripleDES::dec(const byte in[], byte out[]) const
{
u64bit T = (DES_IPTAB1[in[0]] ) | (DES_IPTAB1[in[1]] << 1) |
@@ -246,9 +248,9 @@ void TripleDES::dec(const byte in[], byte out[]) const
store_be(T, out);
}
-/*************************************************
-* TripleDES Key Schedule *
-*************************************************/
+/*
+* TripleDES Key Schedule
+*/
void TripleDES::key_schedule(const byte key[], u32bit length)
{
des_key_schedule(&round_key[0], key);