aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/cast/cast256.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/cast/cast256.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/cast/cast256.cpp')
-rw-r--r--src/block/cast/cast256.cpp46
1 files changed, 24 insertions, 22 deletions
diff --git a/src/block/cast/cast256.cpp b/src/block/cast/cast256.cpp
index b8004851b..993bab46c 100644
--- a/src/block/cast/cast256.cpp
+++ b/src/block/cast/cast256.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* CAST-256 Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* CAST-256
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/cast256.h>
#include <botan/loadstor.h>
@@ -11,9 +13,9 @@ namespace Botan {
namespace {
-/*************************************************
-* CAST-256 Round Type 1 *
-*************************************************/
+/*
+* CAST-256 Round Type 1
+*/
void round1(u32bit& out, u32bit in, u32bit mask, u32bit rot)
{
u32bit temp = rotate_left(mask + in, rot);
@@ -21,9 +23,9 @@ void round1(u32bit& out, u32bit in, u32bit mask, u32bit rot)
CAST_SBOX3[get_byte(2, temp)] + CAST_SBOX4[get_byte(3, temp)];
}
-/*************************************************
-* CAST-256 Round Type 2 *
-*************************************************/
+/*
+* CAST-256 Round Type 2
+*/
void round2(u32bit& out, u32bit in, u32bit mask, u32bit rot)
{
u32bit temp = rotate_left(mask ^ in, rot);
@@ -31,9 +33,9 @@ void round2(u32bit& out, u32bit in, u32bit mask, u32bit rot)
CAST_SBOX3[get_byte(2, temp)]) ^ CAST_SBOX4[get_byte(3, temp)];
}
-/*************************************************
-* CAST-256 Round Type 3 *
-*************************************************/
+/*
+* CAST-256 Round Type 3
+*/
void round3(u32bit& out, u32bit in, u32bit mask, u32bit rot)
{
u32bit temp = rotate_left(mask - in, rot);
@@ -43,9 +45,9 @@ void round3(u32bit& out, u32bit in, u32bit mask, u32bit rot)
}
-/*************************************************
-* CAST-256 Encryption *
-*************************************************/
+/*
+* CAST-256 Encryption
+*/
void CAST_256::enc(const byte in[], byte out[]) const
{
u32bit A = load_be<u32bit>(in, 0);
@@ -81,9 +83,9 @@ void CAST_256::enc(const byte in[], byte out[]) const
store_be(out, A, B, C, D);
}
-/*************************************************
-* CAST-256 Decryption *
-*************************************************/
+/*
+* CAST-256 Decryption
+*/
void CAST_256::dec(const byte in[], byte out[]) const
{
u32bit A = load_be<u32bit>(in, 0);
@@ -119,9 +121,9 @@ void CAST_256::dec(const byte in[], byte out[]) const
store_be(out, A, B, C, D);
}
-/*************************************************
-* CAST-256 Key Schedule *
-*************************************************/
+/*
+* CAST-256 Key Schedule
+*/
void CAST_256::key_schedule(const byte key[], u32bit length)
{
SecureBuffer<u32bit, 8> TMP;