aboutsummaryrefslogtreecommitdiffstats
path: root/src/hash
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/hash
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/hash')
-rw-r--r--src/hash/fork256/fork256.cpp34
-rw-r--r--src/hash/fork256/fork256.h16
-rw-r--r--src/hash/has160/has160.cpp52
-rw-r--r--src/hash/has160/has160.h16
-rw-r--r--src/hash/hash.h2
-rw-r--r--src/hash/md2/md2.cpp4
-rw-r--r--src/hash/md2/md2.h4
-rw-r--r--src/hash/md4/md4.cpp46
-rw-r--r--src/hash/md4/md4.h16
-rw-r--r--src/hash/md4_ia32/md4_ia32.cpp16
-rw-r--r--src/hash/md4_ia32/md4_ia32.h16
-rw-r--r--src/hash/md5/md5.cpp52
-rw-r--r--src/hash/md5/md5.h4
-rw-r--r--src/hash/md5_ia32/md5_ia32.cpp16
-rw-r--r--src/hash/md5_ia32/md5_ia32.h16
-rw-r--r--src/hash/mdx_hash/mdx_hash.cpp2
-rw-r--r--src/hash/mdx_hash/mdx_hash.h4
-rw-r--r--src/hash/par_hash/par_hash.cpp58
-rw-r--r--src/hash/par_hash/par_hash.h16
-rw-r--r--src/hash/rmd128/rmd128.cpp52
-rw-r--r--src/hash/rmd128/rmd128.h16
-rw-r--r--src/hash/rmd160/rmd160.cpp58
-rw-r--r--src/hash/rmd160/rmd160.h16
-rw-r--r--src/hash/sha1/sha160.cpp64
-rw-r--r--src/hash/sha1/sha160.h16
-rw-r--r--src/hash/sha1_amd64/sha1_amd64.cpp16
-rw-r--r--src/hash/sha1_amd64/sha1_amd64.h16
-rw-r--r--src/hash/sha1_ia32/sha1_ia32.cpp16
-rw-r--r--src/hash/sha1_ia32/sha1_ia32.h16
-rw-r--r--src/hash/sha1_sse2/sha1_sse2.cpp16
-rw-r--r--src/hash/sha1_sse2/sha1_sse2.h16
-rw-r--r--src/hash/sha1_sse2/sha1_sse2_imp.cpp14
-rw-r--r--src/hash/sha2/sha2_32.cpp60
-rw-r--r--src/hash/sha2/sha2_32.h30
-rw-r--r--src/hash/sha2/sha2_64.cpp58
-rw-r--r--src/hash/sha2/sha2_64.h28
-rw-r--r--src/hash/tiger/tig_tab.cpp10
-rw-r--r--src/hash/tiger/tiger.cpp52
-rw-r--r--src/hash/tiger/tiger.h16
-rw-r--r--src/hash/whirlpool/whrl_tab.cpp10
-rw-r--r--src/hash/whirlpool/whrlpool.cpp28
-rw-r--r--src/hash/whirlpool/whrlpool.h16
42 files changed, 556 insertions, 474 deletions
diff --git a/src/hash/fork256/fork256.cpp b/src/hash/fork256/fork256.cpp
index dc023004d..070c7cf6c 100644
--- a/src/hash/fork256/fork256.cpp
+++ b/src/hash/fork256/fork256.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* FORK-256 Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* FORK-256
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/fork256.h>
#include <botan/loadstor.h>
@@ -11,9 +13,9 @@ namespace Botan {
namespace {
-/*************************************************
-* FORK-256 Step Function *
-*************************************************/
+/*
+* FORK-256 Step Function
+*/
inline void step(u32bit& A, u32bit& B, u32bit& C, u32bit& D,
u32bit& E, u32bit& F, u32bit& G, u32bit& H,
u32bit M1, u32bit M2, u32bit D1, u32bit D2)
@@ -37,9 +39,9 @@ inline void step(u32bit& A, u32bit& B, u32bit& C, u32bit& D,
}
-/*************************************************
-* FORK-256 Compression Function *
-*************************************************/
+/*
+* FORK-256 Compression Function
+*/
void FORK_256::compress_n(const byte input[], u32bit blocks)
{
const u32bit DELTA[16] = {
@@ -119,18 +121,18 @@ void FORK_256::compress_n(const byte input[], u32bit blocks)
}
}
-/*************************************************
-* Copy out the digest *
-*************************************************/
+/*
+* Copy out the digest
+*/
void FORK_256::copy_out(byte output[])
{
for(u32bit j = 0; j != OUTPUT_LENGTH; j += 4)
store_be(digest[j/4], output + j);
}
-/*************************************************
-* Clear memory of sensitive data *
-*************************************************/
+/*
+* Clear memory of sensitive data
+*/
void FORK_256::clear() throw()
{
MDx_HashFunction::clear();
diff --git a/src/hash/fork256/fork256.h b/src/hash/fork256/fork256.h
index d27e8693f..70d336cc9 100644
--- a/src/hash/fork256/fork256.h
+++ b/src/hash/fork256/fork256.h
@@ -1,7 +1,9 @@
-/*************************************************
-* FORK-256 Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* FORK-256
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_FORK_256_H__
#define BOTAN_FORK_256_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* FORK-256 *
-*************************************************/
+/*
+* FORK-256
+*/
class BOTAN_DLL FORK_256 : public MDx_HashFunction
{
public:
diff --git a/src/hash/has160/has160.cpp b/src/hash/has160/has160.cpp
index f31016629..4441b0b43 100644
--- a/src/hash/has160/has160.cpp
+++ b/src/hash/has160/has160.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* HAS-160 Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* HAS-160
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/has160.h>
#include <botan/loadstor.h>
@@ -11,9 +13,9 @@ namespace Botan {
namespace {
-/*************************************************
-* HAS-160 F1 Function *
-*************************************************/
+/*
+* HAS-160 F1 Function
+*/
inline void F1(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E,
u32bit msg, u32bit rot)
{
@@ -21,9 +23,9 @@ inline void F1(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E,
B = rotate_left(B, 10);
}
-/*************************************************
-* HAS-160 F2 Function *
-*************************************************/
+/*
+* HAS-160 F2 Function
+*/
inline void F2(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E,
u32bit msg, u32bit rot)
{
@@ -31,9 +33,9 @@ inline void F2(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E,
B = rotate_left(B, 17);
}
-/*************************************************
-* HAS-160 F3 Function *
-*************************************************/
+/*
+* HAS-160 F3 Function
+*/
inline void F3(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E,
u32bit msg, u32bit rot)
{
@@ -41,9 +43,9 @@ inline void F3(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E,
B = rotate_left(B, 25);
}
-/*************************************************
-* HAS-160 F4 Function *
-*************************************************/
+/*
+* HAS-160 F4 Function
+*/
inline void F4(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E,
u32bit msg, u32bit rot)
{
@@ -53,9 +55,9 @@ inline void F4(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E,
}
-/*************************************************
-* HAS-160 Compression Function *
-*************************************************/
+/*
+* HAS-160 Compression Function
+*/
void HAS_160::compress_n(const byte input[], u32bit blocks)
{
for(u32bit i = 0; i != blocks; ++i)
@@ -131,18 +133,18 @@ void HAS_160::compress_n(const byte input[], u32bit blocks)
}
}
-/*************************************************
-* Copy out the digest *
-*************************************************/
+/*
+* Copy out the digest
+*/
void HAS_160::copy_out(byte output[])
{
for(u32bit j = 0; j != OUTPUT_LENGTH; j += 4)
store_le(digest[j/4], output + j);
}
-/*************************************************
-* Clear memory of sensitive data *
-*************************************************/
+/*
+* Clear memory of sensitive data
+*/
void HAS_160::clear() throw()
{
MDx_HashFunction::clear();
diff --git a/src/hash/has160/has160.h b/src/hash/has160/has160.h
index d3a422833..44bb63b9d 100644
--- a/src/hash/has160/has160.h
+++ b/src/hash/has160/has160.h
@@ -1,7 +1,9 @@
-/*************************************************
-* HAS-160 Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* HAS-160
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_HAS_160_H__
#define BOTAN_HAS_160_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* HAS-160 *
-*************************************************/
+/*
+* HAS-160
+*/
class BOTAN_DLL HAS_160 : public MDx_HashFunction
{
public:
diff --git a/src/hash/hash.h b/src/hash/hash.h
index 08f1eb3dc..a30234be0 100644
--- a/src/hash/hash.h
+++ b/src/hash/hash.h
@@ -1,6 +1,8 @@
/**
* Hash Function Base Class
* (C) 1999-2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
*/
#ifndef BOTAN_HASH_FUNCTION_BASE_CLASS_H__
diff --git a/src/hash/md2/md2.cpp b/src/hash/md2/md2.cpp
index fbc40fa93..c67e72b5a 100644
--- a/src/hash/md2/md2.cpp
+++ b/src/hash/md2/md2.cpp
@@ -1,6 +1,8 @@
/*
-* MD2 Source File
+* MD2
* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
*/
#include <botan/md2.h>
diff --git a/src/hash/md2/md2.h b/src/hash/md2/md2.h
index 4d06c8872..9337c43f4 100644
--- a/src/hash/md2/md2.h
+++ b/src/hash/md2/md2.h
@@ -1,6 +1,8 @@
/*
-* MD2 Header File
+* MD2
* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
*/
#ifndef BOTAN_MD2_H__
diff --git a/src/hash/md4/md4.cpp b/src/hash/md4/md4.cpp
index 83302f215..c0b52faa4 100644
--- a/src/hash/md4/md4.cpp
+++ b/src/hash/md4/md4.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* MD4 Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* MD4
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/md4.h>
#include <botan/loadstor.h>
@@ -11,27 +13,27 @@ namespace Botan {
namespace {
-/*************************************************
-* MD4 FF Function *
-*************************************************/
+/*
+* MD4 FF Function
+*/
inline void FF(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit M, byte S)
{
A += (D ^ (B & (C ^ D))) + M;
A = rotate_left(A, S);
}
-/*************************************************
-* MD4 GG Function *
-*************************************************/
+/*
+* MD4 GG Function
+*/
inline void GG(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit M, byte S)
{
A += ((B & C) | (D & (B | C))) + M + 0x5A827999;
A = rotate_left(A, S);
}
-/*************************************************
-* MD4 HH Function *
-*************************************************/
+/*
+* MD4 HH Function
+*/
inline void HH(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit M, byte S)
{
A += (B ^ C ^ D) + M + 0x6ED9EBA1;
@@ -40,9 +42,9 @@ inline void HH(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit M, byte S)
}
-/*************************************************
-* MD4 Compression Function *
-*************************************************/
+/*
+* MD4 Compression Function
+*/
void MD4::compress_n(const byte input[], u32bit blocks)
{
u32bit A = digest[0], B = digest[1], C = digest[2], D = digest[3];
@@ -81,18 +83,18 @@ void MD4::compress_n(const byte input[], u32bit blocks)
}
}
-/*************************************************
-* Copy out the digest *
-*************************************************/
+/*
+* Copy out the digest
+*/
void MD4::copy_out(byte output[])
{
for(u32bit j = 0; j != OUTPUT_LENGTH; j += 4)
store_le(digest[j/4], output + j);
}
-/*************************************************
-* Clear memory of sensitive data *
-*************************************************/
+/*
+* Clear memory of sensitive data
+*/
void MD4::clear() throw()
{
MDx_HashFunction::clear();
diff --git a/src/hash/md4/md4.h b/src/hash/md4/md4.h
index 009bba640..df6f2292d 100644
--- a/src/hash/md4/md4.h
+++ b/src/hash/md4/md4.h
@@ -1,7 +1,9 @@
-/*************************************************
-* MD4 Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* MD4
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_MD4_H__
#define BOTAN_MD4_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* MD4 *
-*************************************************/
+/*
+* MD4
+*/
class BOTAN_DLL MD4 : public MDx_HashFunction
{
public:
diff --git a/src/hash/md4_ia32/md4_ia32.cpp b/src/hash/md4_ia32/md4_ia32.cpp
index 6a4b47067..12fe71da4 100644
--- a/src/hash/md4_ia32/md4_ia32.cpp
+++ b/src/hash/md4_ia32/md4_ia32.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* MD4 (IA-32) Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* MD4 (IA-32)
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/md4_ia32.h>
#include <botan/loadstor.h>
@@ -10,9 +12,9 @@ namespace Botan {
extern "C" void botan_md4_ia32_compress(u32bit[4], const byte[64], u32bit[16]);
-/*************************************************
-* MD4 Compression Function *
-*************************************************/
+/*
+* MD4 Compression Function
+*/
void MD4_IA32::compress_n(const byte input[], u32bit blocks)
{
for(u32bit i = 0; i != blocks; ++i)
diff --git a/src/hash/md4_ia32/md4_ia32.h b/src/hash/md4_ia32/md4_ia32.h
index e9798830d..f01d148f4 100644
--- a/src/hash/md4_ia32/md4_ia32.h
+++ b/src/hash/md4_ia32/md4_ia32.h
@@ -1,7 +1,9 @@
-/*************************************************
-* MD4 (IA-32) Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* MD4 (IA-32)
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_MD4_IA32_H__
#define BOTAN_MD4_IA32_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* MD4 *
-*************************************************/
+/*
+* MD4
+*/
class BOTAN_DLL MD4_IA32 : public MD4
{
public:
diff --git a/src/hash/md5/md5.cpp b/src/hash/md5/md5.cpp
index 9a675850a..a5c614330 100644
--- a/src/hash/md5/md5.cpp
+++ b/src/hash/md5/md5.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* MD5 Source File *
-* (C) 1999-2008 Jack Lloyd *
-*************************************************/
+/*
+* MD5
+* (C) 1999-2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/md5.h>
#include <botan/loadstor.h>
@@ -11,9 +13,9 @@ namespace Botan {
namespace {
-/*************************************************
-* MD5 FF Function *
-*************************************************/
+/*
+* MD5 FF Function
+*/
inline void FF(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg,
byte S, u32bit magic)
{
@@ -21,9 +23,9 @@ inline void FF(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg,
A = rotate_left(A, S) + B;
}
-/*************************************************
-* MD5 GG Function *
-*************************************************/
+/*
+* MD5 GG Function
+*/
inline void GG(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg,
byte S, u32bit magic)
{
@@ -31,9 +33,9 @@ inline void GG(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg,
A = rotate_left(A, S) + B;
}
-/*************************************************
-* MD5 HH Function *
-*************************************************/
+/*
+* MD5 HH Function
+*/
inline void HH(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg,
byte S, u32bit magic)
{
@@ -41,9 +43,9 @@ inline void HH(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg,
A = rotate_left(A, S) + B;
}
-/*************************************************
-* MD5 II Function *
-*************************************************/
+/*
+* MD5 II Function
+*/
inline void II(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg,
byte S, u32bit magic)
{
@@ -53,9 +55,9 @@ inline void II(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg,
}
-/*************************************************
-* MD5 Compression Function *
-*************************************************/
+/*
+* MD5 Compression Function
+*/
void MD5::compress_n(const byte input[], u32bit blocks)
{
u32bit A = digest[0], B = digest[1], C = digest[2], D = digest[3];
@@ -109,18 +111,18 @@ void MD5::compress_n(const byte input[], u32bit blocks)
}
}
-/*************************************************
-* Copy out the digest *
-*************************************************/
+/*
+* Copy out the digest
+*/
void MD5::copy_out(byte output[])
{
for(u32bit j = 0; j != OUTPUT_LENGTH; j += 4)
store_le(digest[j/4], output + j);
}
-/*************************************************
-* Clear memory of sensitive data *
-*************************************************/
+/*
+* Clear memory of sensitive data
+*/
void MD5::clear() throw()
{
MDx_HashFunction::clear();
diff --git a/src/hash/md5/md5.h b/src/hash/md5/md5.h
index 8ed72b044..85f684d8b 100644
--- a/src/hash/md5/md5.h
+++ b/src/hash/md5/md5.h
@@ -1,6 +1,8 @@
/**
-* MD5 Header File
+* MD5
* (C) 1999-2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
*/
#ifndef BOTAN_MD5_H__
diff --git a/src/hash/md5_ia32/md5_ia32.cpp b/src/hash/md5_ia32/md5_ia32.cpp
index 15fa7d3dc..443569b3b 100644
--- a/src/hash/md5_ia32/md5_ia32.cpp
+++ b/src/hash/md5_ia32/md5_ia32.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* MD5 (IA-32) Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* MD5 (IA-32)
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/md5_ia32.h>
#include <botan/loadstor.h>
@@ -15,9 +17,9 @@ void botan_md5_ia32_compress(u32bit[4], const byte[64], u32bit[16]);
}
-/*************************************************
-* MD5 Compression Function *
-*************************************************/
+/*
+* MD5 Compression Function
+*/
void MD5_IA32::compress_n(const byte input[], u32bit blocks)
{
for(u32bit i = 0; i != blocks; ++i)
diff --git a/src/hash/md5_ia32/md5_ia32.h b/src/hash/md5_ia32/md5_ia32.h
index a5365aa58..723d724de 100644
--- a/src/hash/md5_ia32/md5_ia32.h
+++ b/src/hash/md5_ia32/md5_ia32.h
@@ -1,7 +1,9 @@
-/*************************************************
-* MD5 (IA-32) Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* MD5 (IA-32)
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_MD5_IA32_H__
#define BOTAN_MD5_IA32_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* MD5 *
-*************************************************/
+/*
+* MD5
+*/
class BOTAN_DLL MD5_IA32 : public MD5
{
public:
diff --git a/src/hash/mdx_hash/mdx_hash.cpp b/src/hash/mdx_hash/mdx_hash.cpp
index 35a06d213..9d011b2d3 100644
--- a/src/hash/mdx_hash/mdx_hash.cpp
+++ b/src/hash/mdx_hash/mdx_hash.cpp
@@ -1,6 +1,8 @@
/**
* Merkle-Damgard Hash Function
* (C) 1999-2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
*/
#include <botan/mdx_hash.h>
diff --git a/src/hash/mdx_hash/mdx_hash.h b/src/hash/mdx_hash/mdx_hash.h
index 484774aea..fc6b60f3f 100644
--- a/src/hash/mdx_hash/mdx_hash.h
+++ b/src/hash/mdx_hash/mdx_hash.h
@@ -1,6 +1,8 @@
/**
-* MDx Hash Function Header File
+* MDx Hash Function
* (C) 1999-2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
*/
#ifndef BOTAN_MDX_BASE_H__
diff --git a/src/hash/par_hash/par_hash.cpp b/src/hash/par_hash/par_hash.cpp
index 67c4799ee..4b0c7c466 100644
--- a/src/hash/par_hash/par_hash.cpp
+++ b/src/hash/par_hash/par_hash.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* Parallel Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* Parallel
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/par_hash.h>
@@ -9,9 +11,9 @@ namespace Botan {
namespace {
-/*************************************************
-* Return the sum of the hash sizes *
-*************************************************/
+/*
+* Return the sum of the hash sizes
+*/
u32bit sum_of_hash_lengths(const std::vector<HashFunction*>& hashes)
{
u32bit sum = 0;
@@ -24,18 +26,18 @@ u32bit sum_of_hash_lengths(const std::vector<HashFunction*>& hashes)
}
-/*************************************************
-* Update the hash *
-*************************************************/
+/*
+* Update the hash
+*/
void Parallel::add_data(const byte input[], u32bit length)
{
for(u32bit j = 0; j != hashes.size(); ++j)
hashes[j]->update(input, length);
}
-/*************************************************
-* Finalize the hash *
-*************************************************/
+/*
+* Finalize the hash
+*/
void Parallel::final_result(byte hash[])
{
u32bit offset = 0;
@@ -46,9 +48,9 @@ void Parallel::final_result(byte hash[])
}
}
-/*************************************************
-* Return the name of this type *
-*************************************************/
+/*
+* Return the name of this type
+*/
std::string Parallel::name() const
{
std::string hash_names;
@@ -61,9 +63,9 @@ std::string Parallel::name() const
return "Parallel(" + hash_names + ")";
}
-/*************************************************
-* Return a clone of this object *
-*************************************************/
+/*
+* Return a clone of this object
+*/
HashFunction* Parallel::clone() const
{
std::vector<HashFunction*> hash_copies;
@@ -72,26 +74,26 @@ HashFunction* Parallel::clone() const
return new Parallel(hash_copies);
}
-/*************************************************
-* Clear memory of sensitive data *
-*************************************************/
+/*
+* Clear memory of sensitive data
+*/
void Parallel::clear() throw()
{
for(u32bit j = 0; j != hashes.size(); ++j)
hashes[j]->clear();
}
-/*************************************************
-* Parallel Constructor *
-*************************************************/
+/*
+* Parallel Constructor
+*/
Parallel::Parallel(const std::vector<HashFunction*>& hash_in) :
HashFunction(sum_of_hash_lengths(hash_in)), hashes(hash_in)
{
}
-/*************************************************
-* Parallel Destructor *
-*************************************************/
+/*
+* Parallel Destructor
+*/
Parallel::~Parallel()
{
for(u32bit j = 0; j != hashes.size(); ++j)
diff --git a/src/hash/par_hash/par_hash.h b/src/hash/par_hash/par_hash.h
index 7d71dae11..7e75c27be 100644
--- a/src/hash/par_hash/par_hash.h
+++ b/src/hash/par_hash/par_hash.h
@@ -1,7 +1,9 @@
-/*************************************************
-* Parallel Hash Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* Parallel Hash
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_PARALLEL_HASH_H__
#define BOTAN_PARALLEL_HASH_H__
@@ -11,9 +13,9 @@
namespace Botan {
-/*************************************************
-* Parallel *
-*************************************************/
+/*
+* Parallel
+*/
class BOTAN_DLL Parallel : public HashFunction
{
public:
diff --git a/src/hash/rmd128/rmd128.cpp b/src/hash/rmd128/rmd128.cpp
index 52d0c5f56..b6d0a4590 100644
--- a/src/hash/rmd128/rmd128.cpp
+++ b/src/hash/rmd128/rmd128.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* RIPEMD-128 Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* RIPEMD-128
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/rmd128.h>
#include <botan/loadstor.h>
@@ -11,9 +13,9 @@ namespace Botan {
namespace {
-/*************************************************
-* RIPEMD-128 F1 Function *
-*************************************************/
+/*
+* RIPEMD-128 F1 Function
+*/
inline void F1(u32bit& A, u32bit B, u32bit C, u32bit D,
u32bit msg, u32bit shift)
{
@@ -21,9 +23,9 @@ inline void F1(u32bit& A, u32bit B, u32bit C, u32bit D,
A = rotate_left(A, shift);
}
-/*************************************************
-* RIPEMD-128 F2 Function *
-*************************************************/
+/*
+* RIPEMD-128 F2 Function
+*/
inline void F2(u32bit& A, u32bit B, u32bit C, u32bit D,
u32bit msg, u32bit shift, u32bit magic)
{
@@ -31,9 +33,9 @@ inline void F2(u32bit& A, u32bit B, u32bit C, u32bit D,
A = rotate_left(A, shift);
}
-/*************************************************
-* RIPEMD-128 F3 Function *
-*************************************************/
+/*
+* RIPEMD-128 F3 Function
+*/
inline void F3(u32bit& A, u32bit B, u32bit C, u32bit D,
u32bit msg, u32bit shift, u32bit magic)
{
@@ -41,9 +43,9 @@ inline void F3(u32bit& A, u32bit B, u32bit C, u32bit D,
A = rotate_left(A, shift);
}
-/*************************************************
-* RIPEMD-128 F4 Function *
-*************************************************/
+/*
+* RIPEMD-128 F4 Function
+*/
inline void F4(u32bit& A, u32bit B, u32bit C, u32bit D,
u32bit msg, u32bit shift, u32bit magic)
{
@@ -53,9 +55,9 @@ inline void F4(u32bit& A, u32bit B, u32bit C, u32bit D,
}
-/*************************************************
-* RIPEMD-128 Compression Function *
-*************************************************/
+/*
+* RIPEMD-128 Compression Function
+*/
void RIPEMD_128::compress_n(const byte input[], u32bit blocks)
{
for(u32bit i = 0; i != blocks; ++i)
@@ -145,18 +147,18 @@ void RIPEMD_128::compress_n(const byte input[], u32bit blocks)
}
}
-/*************************************************
-* Copy out the digest *
-*************************************************/
+/*
+* Copy out the digest
+*/
void RIPEMD_128::copy_out(byte output[])
{
for(u32bit j = 0; j != OUTPUT_LENGTH; j += 4)
store_le(digest[j/4], output + j);
}
-/*************************************************
-* Clear memory of sensitive data *
-*************************************************/
+/*
+* Clear memory of sensitive data
+*/
void RIPEMD_128::clear() throw()
{
MDx_HashFunction::clear();
diff --git a/src/hash/rmd128/rmd128.h b/src/hash/rmd128/rmd128.h
index 923b2bf80..031ae5746 100644
--- a/src/hash/rmd128/rmd128.h
+++ b/src/hash/rmd128/rmd128.h
@@ -1,7 +1,9 @@
-/*************************************************
-* RIPEMD-128 Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* RIPEMD-128
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_RIPEMD_128_H__
#define BOTAN_RIPEMD_128_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* RIPEMD-128 *
-*************************************************/
+/*
+* RIPEMD-128
+*/
class BOTAN_DLL RIPEMD_128 : public MDx_HashFunction
{
public:
diff --git a/src/hash/rmd160/rmd160.cpp b/src/hash/rmd160/rmd160.cpp
index 249ce7fb1..3efbe674a 100644
--- a/src/hash/rmd160/rmd160.cpp
+++ b/src/hash/rmd160/rmd160.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* RIPEMD-160 Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* RIPEMD-160
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/rmd160.h>
#include <botan/loadstor.h>
@@ -11,9 +13,9 @@ namespace Botan {
namespace {
-/*************************************************
-* RIPEMD-160 F1 Function *
-*************************************************/
+/*
+* RIPEMD-160 F1 Function
+*/
inline void F1(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E,
u32bit msg, u32bit shift)
{
@@ -22,9 +24,9 @@ inline void F1(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E,
C = rotate_left(C, 10);
}
-/*************************************************
-* RIPEMD-160 F2 Function *
-*************************************************/
+/*
+* RIPEMD-160 F2 Function
+*/
inline void F2(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E,
u32bit msg, u32bit shift, u32bit magic)
{
@@ -33,9 +35,9 @@ inline void F2(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E,
C = rotate_left(C, 10);
}
-/*************************************************
-* RIPEMD-160 F3 Function *
-*************************************************/
+/*
+* RIPEMD-160 F3 Function
+*/
inline void F3(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E,
u32bit msg, u32bit shift, u32bit magic)
{
@@ -44,9 +46,9 @@ inline void F3(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E,
C = rotate_left(C, 10);
}
-/*************************************************
-* RIPEMD-160 F4 Function *
-*************************************************/
+/*
+* RIPEMD-160 F4 Function
+*/
inline void F4(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E,
u32bit msg, u32bit shift, u32bit magic)
{
@@ -55,9 +57,9 @@ inline void F4(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E,
C = rotate_left(C, 10);
}
-/*************************************************
-* RIPEMD-160 F5 Function *
-*************************************************/
+/*
+* RIPEMD-160 F5 Function
+*/
inline void F5(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E,
u32bit msg, u32bit shift, u32bit magic)
{
@@ -68,9 +70,9 @@ inline void F5(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E,
}
-/*************************************************
-* RIPEMD-160 Compression Function *
-*************************************************/
+/*
+* RIPEMD-160 Compression Function
+*/
void RIPEMD_160::compress_n(const byte input[], u32bit blocks)
{
const u32bit MAGIC2 = 0x5A827999, MAGIC3 = 0x6ED9EBA1,
@@ -182,18 +184,18 @@ void RIPEMD_160::compress_n(const byte input[], u32bit blocks)
}
}
-/*************************************************
-* Copy out the digest *
-*************************************************/
+/*
+* Copy out the digest
+*/
void RIPEMD_160::copy_out(byte output[])
{
for(u32bit j = 0; j != OUTPUT_LENGTH; j += 4)
store_le(digest[j/4], output + j);
}
-/*************************************************
-* Clear memory of sensitive data *
-*************************************************/
+/*
+* Clear memory of sensitive data
+*/
void RIPEMD_160::clear() throw()
{
MDx_HashFunction::clear();
diff --git a/src/hash/rmd160/rmd160.h b/src/hash/rmd160/rmd160.h
index 939fe5668..f2babc582 100644
--- a/src/hash/rmd160/rmd160.h
+++ b/src/hash/rmd160/rmd160.h
@@ -1,7 +1,9 @@
-/*************************************************
-* RIPEMD-160 Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* RIPEMD-160
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_RIPEMD_160_H__
#define BOTAN_RIPEMD_160_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* RIPEMD-160 *
-*************************************************/
+/*
+* RIPEMD-160
+*/
class BOTAN_DLL RIPEMD_160 : public MDx_HashFunction
{
public:
diff --git a/src/hash/sha1/sha160.cpp b/src/hash/sha1/sha160.cpp
index 231dbeb12..58a800c9f 100644
--- a/src/hash/sha1/sha160.cpp
+++ b/src/hash/sha1/sha160.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* SHA-160 Source File *
-* (C) 1999-2008 Jack Lloyd *
-*************************************************/
+/*
+* SHA-160
+* (C) 1999-2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/sha160.h>
#include <botan/loadstor.h>
@@ -11,36 +13,36 @@ namespace Botan {
namespace {
-/*************************************************
-* SHA-160 F1 Function *
-*************************************************/
+/*
+* SHA-160 F1 Function
+*/
inline void F1(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg)
{
E += (D ^ (B & (C ^ D))) + msg + 0x5A827999 + rotate_left(A, 5);
B = rotate_left(B, 30);
}
-/*************************************************
-* SHA-160 F2 Function *
-*************************************************/
+/*
+* SHA-160 F2 Function
+*/
inline void F2(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg)
{
E += (B ^ C ^ D) + msg + 0x6ED9EBA1 + rotate_left(A, 5);
B = rotate_left(B, 30);
}
-/*************************************************
-* SHA-160 F3 Function *
-*************************************************/
+/*
+* SHA-160 F3 Function
+*/
inline void F3(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg)
{
E += ((B & C) | ((B | C) & D)) + msg + 0x8F1BBCDC + rotate_left(A, 5);
B = rotate_left(B, 30);
}
-/*************************************************
-* SHA-160 F4 Function *
-*************************************************/
+/*
+* SHA-160 F4 Function
+*/
inline void F4(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg)
{
E += (B ^ C ^ D) + msg + 0xCA62C1D6 + rotate_left(A, 5);
@@ -49,9 +51,9 @@ inline void F4(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg)
}
-/*************************************************
-* SHA-160 Compression Function *
-*************************************************/
+/*
+* SHA-160 Compression Function
+*/
void SHA_160::compress_n(const byte input[], u32bit blocks)
{
u32bit A = digest[0], B = digest[1], C = digest[2],
@@ -116,18 +118,18 @@ void SHA_160::compress_n(const byte input[], u32bit blocks)
}
}
-/*************************************************
-* Copy out the digest *
-*************************************************/
+/*
+* Copy out the digest
+*/
void SHA_160::copy_out(byte output[])
{
for(u32bit j = 0; j != OUTPUT_LENGTH; j += 4)
store_be(digest[j/4], output + j);
}
-/*************************************************
-* Clear memory of sensitive data *
-*************************************************/
+/*
+* Clear memory of sensitive data
+*/
void SHA_160::clear() throw()
{
MDx_HashFunction::clear();
@@ -139,18 +141,18 @@ void SHA_160::clear() throw()
digest[4] = 0xC3D2E1F0;
}
-/*************************************************
-* SHA_160 Constructor *
-*************************************************/
+/*
+* SHA_160 Constructor
+*/
SHA_160::SHA_160() :
MDx_HashFunction(20, 64, true, true), W(80)
{
clear();
}
-/*************************************************
-* SHA_160 Constructor *
-*************************************************/
+/*
+* SHA_160 Constructor
+*/
SHA_160::SHA_160(u32bit W_size) :
MDx_HashFunction(20, 64, true, true), W(W_size)
{
diff --git a/src/hash/sha1/sha160.h b/src/hash/sha1/sha160.h
index 640a8a683..232cf0322 100644
--- a/src/hash/sha1/sha160.h
+++ b/src/hash/sha1/sha160.h
@@ -1,7 +1,9 @@
-/*************************************************
-* SHA-160 Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* SHA-160
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_SHA_160_H__
#define BOTAN_SHA_160_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* SHA-160 *
-*************************************************/
+/*
+* SHA-160
+*/
class BOTAN_DLL SHA_160 : public MDx_HashFunction
{
public:
diff --git a/src/hash/sha1_amd64/sha1_amd64.cpp b/src/hash/sha1_amd64/sha1_amd64.cpp
index f69c1fdd0..0efbd8559 100644
--- a/src/hash/sha1_amd64/sha1_amd64.cpp
+++ b/src/hash/sha1_amd64/sha1_amd64.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* SHA-160 Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* SHA-160
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/sha1_amd64.h>
@@ -14,9 +16,9 @@ void botan_sha160_amd64_compress(u32bit[5], const byte[64], u32bit[80]);
}
-/*************************************************
-* SHA-160 Compression Function *
-*************************************************/
+/*
+* SHA-160 Compression Function
+*/
void SHA_160_AMD64::compress_n(const byte input[], u32bit blocks)
{
for(u32bit i = 0; i != blocks; ++i)
diff --git a/src/hash/sha1_amd64/sha1_amd64.h b/src/hash/sha1_amd64/sha1_amd64.h
index 38a83e4de..f182627a8 100644
--- a/src/hash/sha1_amd64/sha1_amd64.h
+++ b/src/hash/sha1_amd64/sha1_amd64.h
@@ -1,7 +1,9 @@
-/*************************************************
-* SHA-160 (x86-64) Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* SHA-160 (x86-64)
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_SHA_160_AMD64_H__
#define BOTAN_SHA_160_AMD64_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* SHA-160 *
-*************************************************/
+/*
+* SHA-160
+*/
class BOTAN_DLL SHA_160_AMD64 : public SHA_160
{
public:
diff --git a/src/hash/sha1_ia32/sha1_ia32.cpp b/src/hash/sha1_ia32/sha1_ia32.cpp
index 5c3e56a73..0fa0b6bf2 100644
--- a/src/hash/sha1_ia32/sha1_ia32.cpp
+++ b/src/hash/sha1_ia32/sha1_ia32.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* SHA-160 (IA-32) Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* SHA-160 (IA-32)
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/sha1_ia32.h>
#include <botan/loadstor.h>
@@ -15,9 +17,9 @@ void botan_sha160_ia32_compress(u32bit[5], const byte[64], u32bit[81]);
}
-/*************************************************
-* SHA-160 Compression Function *
-*************************************************/
+/*
+* SHA-160 Compression Function
+*/
void SHA_160_IA32::compress_n(const byte input[], u32bit blocks)
{
for(u32bit i = 0; i != blocks; ++i)
diff --git a/src/hash/sha1_ia32/sha1_ia32.h b/src/hash/sha1_ia32/sha1_ia32.h
index 403095f11..fd34971cb 100644
--- a/src/hash/sha1_ia32/sha1_ia32.h
+++ b/src/hash/sha1_ia32/sha1_ia32.h
@@ -1,7 +1,9 @@
-/*************************************************
-* SHA-160 (IA-32) Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* SHA-160 (IA-32)
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_SHA_160_IA32_H__
#define BOTAN_SHA_160_IA32_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* SHA-160 *
-*************************************************/
+/*
+* SHA-160
+*/
class BOTAN_DLL SHA_160_IA32 : public SHA_160
{
public:
diff --git a/src/hash/sha1_sse2/sha1_sse2.cpp b/src/hash/sha1_sse2/sha1_sse2.cpp
index e2e0352fe..dddc06b7b 100644
--- a/src/hash/sha1_sse2/sha1_sse2.cpp
+++ b/src/hash/sha1_sse2/sha1_sse2.cpp
@@ -1,15 +1,17 @@
-/*************************************************
-* SHA-160 (SSE2) Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* SHA-160 (SSE2)
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/sha1_sse2.h>
namespace Botan {
-/*************************************************
-* SHA-160 Compression Function *
-*************************************************/
+/*
+* SHA-160 Compression Function
+*/
void SHA_160_SSE2::compress_n(const byte input[], u32bit blocks)
{
for(u32bit i = 0; i != blocks; ++i)
diff --git a/src/hash/sha1_sse2/sha1_sse2.h b/src/hash/sha1_sse2/sha1_sse2.h
index 57348e461..0f8eebee9 100644
--- a/src/hash/sha1_sse2/sha1_sse2.h
+++ b/src/hash/sha1_sse2/sha1_sse2.h
@@ -1,7 +1,9 @@
-/*************************************************
-* SHA-160 Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* SHA-160
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_SHA_160_SSE2_H__
#define BOTAN_SHA_160_SSE2_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* SHA-160 *
-*************************************************/
+/*
+* SHA-160
+*/
class BOTAN_DLL SHA_160_SSE2 : public SHA_160
{
public:
diff --git a/src/hash/sha1_sse2/sha1_sse2_imp.cpp b/src/hash/sha1_sse2/sha1_sse2_imp.cpp
index b736938c8..90a8dccd5 100644
--- a/src/hash/sha1_sse2/sha1_sse2_imp.cpp
+++ b/src/hash/sha1_sse2/sha1_sse2_imp.cpp
@@ -1,24 +1,24 @@
/* this code is public domain.
- *
+
* dean gaudet <[email protected]>
- *
+
* this code was inspired by this paper:
- *
+
* SHA: A Design for Parallel Architectures?
* Antoon Bosselaers, Ren�e Govaerts and Joos Vandewalle
* <http://www.esat.kuleuven.ac.be/~cosicart/pdf/AB-9700.pdf>
- *
+
* more information available on this implementation here:
- *
+
* http://arctic.org/~dean/crypto/sha1.html
- *
+
* version: 2
*/
/*
* Lightly modified for Botan, tested under GCC 4.1.1 and ICC 9.1
* on a Linux/Core2 system.
- *
+
*/
#include <botan/sha1_sse2.h>
#include <xmmintrin.h>
diff --git a/src/hash/sha2/sha2_32.cpp b/src/hash/sha2/sha2_32.cpp
index 52528e6fd..7c3114daf 100644
--- a/src/hash/sha2/sha2_32.cpp
+++ b/src/hash/sha2/sha2_32.cpp
@@ -1,8 +1,10 @@
-/*************************************************
-* SHA-{224,256} Source File *
-* (C) 1999-2008 Jack Lloyd *
-* 2007 FlexSecure GmbH *
-*************************************************/
+/*
+* SHA-{224,256}
+* (C) 1999-2008 Jack Lloyd
+* 2007 FlexSecure GmbH
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/sha2_32.h>
#include <botan/loadstor.h>
@@ -12,26 +14,26 @@ namespace Botan {
namespace {
-/*************************************************
-* SHA-256 Rho Function *
-*************************************************/
+/*
+* SHA-256 Rho Function
+*/
inline u32bit rho(u32bit X, u32bit rot1, u32bit rot2, u32bit rot3)
{
return (rotate_right(X, rot1) ^ rotate_right(X, rot2) ^
rotate_right(X, rot3));
}
-/*************************************************
-* SHA-256 Sigma Function *
-*************************************************/
+/*
+* SHA-256 Sigma Function
+*/
inline u32bit sigma(u32bit X, u32bit rot1, u32bit rot2, u32bit shift)
{
return (rotate_right(X, rot1) ^ rotate_right(X, rot2) ^ (X >> shift));
}
-/*************************************************
-* SHA-256 F1 Function *
-*************************************************/
+/*
+* SHA-256 F1 Function
+*/
inline void F1(u32bit A, u32bit B, u32bit C, u32bit& D,
u32bit E, u32bit F, u32bit G, u32bit& H,
u32bit msg, u32bit magic)
@@ -43,9 +45,9 @@ inline void F1(u32bit A, u32bit B, u32bit C, u32bit& D,
}
-/*************************************************
-* SHA-256 Compression Function *
-*************************************************/
+/*
+* SHA-256 Compression Function
+*/
void SHA_224_256_BASE::compress_n(const byte input[], u32bit blocks)
{
u32bit A = digest[0], B = digest[1], C = digest[2],
@@ -138,27 +140,27 @@ void SHA_224_256_BASE::compress_n(const byte input[], u32bit blocks)
}
}
-/*************************************************
-* Copy out the digest *
-*************************************************/
+/*
+* Copy out the digest
+*/
void SHA_224_256_BASE::copy_out(byte output[])
{
for(u32bit j = 0; j != OUTPUT_LENGTH; j += 4)
store_be(digest[j/4], output + j);
}
-/*************************************************
-* Clear memory of sensitive data *
-*************************************************/
+/*
+* Clear memory of sensitive data
+*/
void SHA_224_256_BASE::clear() throw()
{
MDx_HashFunction::clear();
W.clear();
}
-/*************************************************
-* Clear memory of sensitive data *
-*************************************************/
+/*
+* Clear memory of sensitive data
+*/
void SHA_224::clear() throw()
{
SHA_224_256_BASE::clear();
@@ -172,9 +174,9 @@ void SHA_224::clear() throw()
digest[7] = 0xbefa4fa4;
}
-/*************************************************
-* Clear memory of sensitive data *
-*************************************************/
+/*
+* Clear memory of sensitive data
+*/
void SHA_256::clear() throw()
{
SHA_224_256_BASE::clear();
diff --git a/src/hash/sha2/sha2_32.h b/src/hash/sha2/sha2_32.h
index f4c8d978a..05083d19d 100644
--- a/src/hash/sha2/sha2_32.h
+++ b/src/hash/sha2/sha2_32.h
@@ -1,8 +1,10 @@
-/*************************************************
-* SHA-{224,256} Header File *
-* (C) 1999-2008 Jack Lloyd *
-* 2007 FlexSecure GmbH *
-*************************************************/
+/*
+* SHA-{224,256}
+* (C) 1999-2008 Jack Lloyd
+* 2007 FlexSecure GmbH
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_SHA_256_H__
#define BOTAN_SHA_256_H__
@@ -11,9 +13,9 @@
namespace Botan {
-/*************************************************
-* SHA-{224,256} Base *
-*************************************************/
+/*
+* SHA-{224,256} Base
+*/
class BOTAN_DLL SHA_224_256_BASE : public MDx_HashFunction
{
protected:
@@ -28,9 +30,9 @@ class BOTAN_DLL SHA_224_256_BASE : public MDx_HashFunction
void copy_out(byte[]);
};
-/*************************************************
-* SHA-224 *
-*************************************************/
+/*
+* SHA-224
+*/
class BOTAN_DLL SHA_224 : public SHA_224_256_BASE
{
public:
@@ -40,9 +42,9 @@ class BOTAN_DLL SHA_224 : public SHA_224_256_BASE
SHA_224() : SHA_224_256_BASE(28) { clear(); }
};
-/*************************************************
-* SHA-256 *
-*************************************************/
+/*
+* SHA-256
+*/
class BOTAN_DLL SHA_256 : public SHA_224_256_BASE
{
public:
diff --git a/src/hash/sha2/sha2_64.cpp b/src/hash/sha2/sha2_64.cpp
index cafa06e53..dbbfc5a96 100644
--- a/src/hash/sha2/sha2_64.cpp
+++ b/src/hash/sha2/sha2_64.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* SHA-{384,512} Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* SHA-{384,512}
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/sha2_64.h>
#include <botan/loadstor.h>
@@ -11,18 +13,18 @@ namespace Botan {
namespace {
-/*************************************************
-* SHA-{384,512} Rho Function *
-*************************************************/
+/*
+* SHA-{384,512} Rho Function
+*/
inline u64bit rho(u64bit X, u32bit rot1, u32bit rot2, u32bit rot3)
{
return (rotate_right(X, rot1) ^ rotate_right(X, rot2) ^
rotate_right(X, rot3));
}
-/*************************************************
-* SHA-{384,512} F1 Function *
-*************************************************/
+/*
+* SHA-{384,512} F1 Function
+*/
inline void F1(u64bit A, u64bit B, u64bit C, u64bit& D,
u64bit E, u64bit F, u64bit G, u64bit& H,
u64bit msg, u64bit magic)
@@ -32,9 +34,9 @@ inline void F1(u64bit A, u64bit B, u64bit C, u64bit& D,
H += magic + rho(A, 28, 34, 39) + ((A & B) ^ (A & C) ^ (B & C));
}
-/*************************************************
-* SHA-{384,512} Sigma Function *
-*************************************************/
+/*
+* SHA-{384,512} Sigma Function
+*/
inline u64bit sigma(u64bit X, u32bit rot1, u32bit rot2, u32bit shift)
{
return (rotate_right(X, rot1) ^ rotate_right(X, rot2) ^ (X >> shift));
@@ -42,9 +44,9 @@ inline u64bit sigma(u64bit X, u32bit rot1, u32bit rot2, u32bit shift)
}
-/*************************************************
-* SHA-{384,512} Compression Function *
-*************************************************/
+/*
+* SHA-{384,512} Compression Function
+*/
void SHA_384_512_BASE::compress_n(const byte input[], u32bit blocks)
{
u64bit A = digest[0], B = digest[1], C = digest[2],
@@ -153,27 +155,27 @@ void SHA_384_512_BASE::compress_n(const byte input[], u32bit blocks)
}
}
-/*************************************************
-* Copy out the digest *
-*************************************************/
+/*
+* Copy out the digest
+*/
void SHA_384_512_BASE::copy_out(byte output[])
{
for(u32bit j = 0; j != OUTPUT_LENGTH; j += 8)
store_be(digest[j/8], output + j);
}
-/*************************************************
-* Clear memory of sensitive data *
-*************************************************/
+/*
+* Clear memory of sensitive data
+*/
void SHA_384_512_BASE::clear() throw()
{
MDx_HashFunction::clear();
W.clear();
}
-/*************************************************
-* Clear memory of sensitive data *
-*************************************************/
+/*
+* Clear memory of sensitive data
+*/
void SHA_384::clear() throw()
{
SHA_384_512_BASE::clear();
@@ -187,9 +189,9 @@ void SHA_384::clear() throw()
digest[7] = 0x47B5481DBEFA4FA4;
}
-/*************************************************
-* Clear memory of sensitive data *
-*************************************************/
+/*
+* Clear memory of sensitive data
+*/
void SHA_512::clear() throw()
{
SHA_384_512_BASE::clear();
diff --git a/src/hash/sha2/sha2_64.h b/src/hash/sha2/sha2_64.h
index 51efb455b..dcc6dc83b 100644
--- a/src/hash/sha2/sha2_64.h
+++ b/src/hash/sha2/sha2_64.h
@@ -1,7 +1,9 @@
-/*************************************************
-* SHA-{384,512} Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* SHA-{384,512}
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_SHA_64BIT_H__
#define BOTAN_SHA_64BIT_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* SHA-{384,512} Base *
-*************************************************/
+/*
+* SHA-{384,512} Base
+*/
class BOTAN_DLL SHA_384_512_BASE : public MDx_HashFunction
{
protected:
@@ -29,9 +31,9 @@ class BOTAN_DLL SHA_384_512_BASE : public MDx_HashFunction
SecureBuffer<u64bit, 80> W;
};
-/*************************************************
-* SHA-384 *
-*************************************************/
+/*
+* SHA-384
+*/
class BOTAN_DLL SHA_384 : public SHA_384_512_BASE
{
public:
@@ -41,9 +43,9 @@ class BOTAN_DLL SHA_384 : public SHA_384_512_BASE
SHA_384() : SHA_384_512_BASE(48) { clear(); }
};
-/*************************************************
-* SHA-512 *
-*************************************************/
+/*
+* SHA-512
+*/
class BOTAN_DLL SHA_512 : public SHA_384_512_BASE
{
public:
diff --git a/src/hash/tiger/tig_tab.cpp b/src/hash/tiger/tig_tab.cpp
index 6d476f4b3..b76501d74 100644
--- a/src/hash/tiger/tig_tab.cpp
+++ b/src/hash/tiger/tig_tab.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* S-Box Tables for Tiger *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* S-Box Tables for Tiger
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/tiger.h>
diff --git a/src/hash/tiger/tiger.cpp b/src/hash/tiger/tiger.cpp
index f8042075b..e46f2cb77 100644
--- a/src/hash/tiger/tiger.cpp
+++ b/src/hash/tiger/tiger.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* Tiger Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* Tiger
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/tiger.h>
#include <botan/exceptn.h>
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* Tiger Compression Function *
-*************************************************/
+/*
+* Tiger Compression Function
+*/
void Tiger::compress_n(const byte input[], u32bit blocks)
{
u64bit A = digest[0], B = digest[1], C = digest[2];
@@ -40,18 +42,18 @@ void Tiger::compress_n(const byte input[], u32bit blocks)
}
}
-/*************************************************
-* Copy out the digest *
-*************************************************/
+/*
+* Copy out the digest
+*/
void Tiger::copy_out(byte output[])
{
for(u32bit j = 0; j != OUTPUT_LENGTH; ++j)
output[j] = get_byte(7 - (j % 8), digest[j/8]);
}
-/*************************************************
-* Tiger Pass *
-*************************************************/
+/*
+* Tiger Pass
+*/
void Tiger::pass(u64bit& A, u64bit& B, u64bit& C, u64bit X[8], byte mul)
{
C ^= X[0];
@@ -111,9 +113,9 @@ void Tiger::pass(u64bit& A, u64bit& B, u64bit& C, u64bit X[8], byte mul)
C *= mul;
}
-/*************************************************
-* Tiger Mixing Function *
-*************************************************/
+/*
+* Tiger Mixing Function
+*/
void Tiger::mix(u64bit X[8])
{
X[0] -= X[7] ^ 0xA5A5A5A5A5A5A5A5; X[1] ^= X[0];
@@ -124,9 +126,9 @@ void Tiger::mix(u64bit X[8])
X[6] += X[5]; X[7] -= X[6] ^ 0x0123456789ABCDEF;
}
-/*************************************************
-* Clear memory of sensitive data *
-*************************************************/
+/*
+* Clear memory of sensitive data
+*/
void Tiger::clear() throw()
{
MDx_HashFunction::clear();
@@ -136,17 +138,17 @@ void Tiger::clear() throw()
digest[2] = 0xF096A5B4C3B2E187;
}
-/*************************************************
-* Return the name of this type *
-*************************************************/
+/*
+* Return the name of this type
+*/
std::string Tiger::name() const
{
return "Tiger(" + to_string(OUTPUT_LENGTH) + "," + to_string(PASS) + ")";
}
-/*************************************************
-* Tiger Constructor *
-*************************************************/
+/*
+* Tiger Constructor
+*/
Tiger::Tiger(u32bit hashlen, u32bit pass) :
MDx_HashFunction(hashlen, 64, false, false), PASS(pass)
{
diff --git a/src/hash/tiger/tiger.h b/src/hash/tiger/tiger.h
index 4cbe1c419..63184a938 100644
--- a/src/hash/tiger/tiger.h
+++ b/src/hash/tiger/tiger.h
@@ -1,7 +1,9 @@
-/*************************************************
-* Tiger Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* Tiger
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_TIGER_H__
#define BOTAN_TIGER_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* Tiger *
-*************************************************/
+/*
+* Tiger
+*/
class BOTAN_DLL Tiger : public MDx_HashFunction
{
public:
diff --git a/src/hash/whirlpool/whrl_tab.cpp b/src/hash/whirlpool/whrl_tab.cpp
index bd616ca27..cf670f308 100644
--- a/src/hash/whirlpool/whrl_tab.cpp
+++ b/src/hash/whirlpool/whrl_tab.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* Diffusion Tables for Whirlpool *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* Diffusion Tables for Whirlpool
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/whrlpool.h>
diff --git a/src/hash/whirlpool/whrlpool.cpp b/src/hash/whirlpool/whrlpool.cpp
index b604f9400..8548d6192 100644
--- a/src/hash/whirlpool/whrlpool.cpp
+++ b/src/hash/whirlpool/whrlpool.cpp
@@ -1,16 +1,18 @@
-/*************************************************
-* Whirlpool Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* Whirlpool
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/whrlpool.h>
#include <botan/loadstor.h>
namespace Botan {
-/*************************************************
-* Whirlpool Compression Function *
-*************************************************/
+/*
+* Whirlpool Compression Function
+*/
void Whirlpool::compress_n(const byte in[], u32bit blocks)
{
static const u64bit RC[10] = {
@@ -122,18 +124,18 @@ void Whirlpool::compress_n(const byte in[], u32bit blocks)
}
}
-/*************************************************
-* Copy out the digest *
-*************************************************/
+/*
+* Copy out the digest
+*/
void Whirlpool::copy_out(byte output[])
{
for(u32bit j = 0; j != OUTPUT_LENGTH; j += 8)
store_be(digest[j/8], output + j);
}
-/*************************************************
-* Clear memory of sensitive data *
-*************************************************/
+/*
+* Clear memory of sensitive data
+*/
void Whirlpool::clear() throw()
{
MDx_HashFunction::clear();
diff --git a/src/hash/whirlpool/whrlpool.h b/src/hash/whirlpool/whrlpool.h
index 25a5bb34d..b72ff609f 100644
--- a/src/hash/whirlpool/whrlpool.h
+++ b/src/hash/whirlpool/whrlpool.h
@@ -1,7 +1,9 @@
-/*************************************************
-* Whirlpool Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* Whirlpool
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_WHIRLPOOL_H__
#define BOTAN_WHIRLPOOL_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* Whirlpool *
-*************************************************/
+/*
+* Whirlpool
+*/
class BOTAN_DLL Whirlpool : public MDx_HashFunction
{
public: