aboutsummaryrefslogtreecommitdiffstats
path: root/src/hash/sha2/sha2_32.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/hash/sha2/sha2_32.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/hash/sha2/sha2_32.cpp')
-rw-r--r--src/hash/sha2/sha2_32.cpp60
1 files changed, 31 insertions, 29 deletions
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();