diff options
author | Jeffrey Walton <noloader@gmail.com> | 2018-08-18 21:41:13 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2018-08-18 21:41:13 -0400 |
commit | 92163356db5c31600b9b1ecf9cd4986fb92db76e (patch) | |
tree | 6e4a7d00c16602287e299965012ec5b26155d2a1 /wake.cpp | |
parent | 03d78fb783a08d354188c3c2737733a3f6512464 (diff) | |
download | cryptopp-git-92163356db5c31600b9b1ecf9cd4986fb92db76e.tar.gz |
Move constant table to unnamed namespace
Diffstat (limited to 'wake.cpp')
-rw-r--r-- | wake.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -5,6 +5,15 @@ #include "wake.h"
#include "smartptr.h"
+ANONYMOUS_NAMESPACE_BEGIN
+
+const unsigned int TT[8]= {
+ 0x726a8f3b, 0xe69a3b5c, 0xd3c71fe5, 0xab3c73d2,
+ 0x4d3a8eb3, 0x0396d6e8, 0x3d4c2f7a, 0x9ee27cf3
+} ;
+
+ANONYMOUS_NAMESPACE_END
+
NAMESPACE_BEGIN(CryptoPP)
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
@@ -25,17 +34,7 @@ void WAKE_Base::GenKey(word32 k0, word32 k1, word32 k2, word32 k3) {
// this code is mostly copied from David Wheeler's paper "A Bulk Data Encryption Algorithm"
signed int x, z, p;
- // x and z were declared as "long" in Wheeler's paper, which is a signed type. I don't know if that was intentional, but it's too late to change it now. -- Wei 7/4/2010
- CRYPTOPP_COMPILE_ASSERT(sizeof(x) == 4);
- static unsigned int tt[10]= {
- 0x726a8f3b, // table
- 0xe69a3b5c,
- 0xd3c71fe5,
- 0xab3c73d2,
- 0x4d3a8eb3,
- 0x0396d6e8,
- 0x3d4c2f7a,
- 0x9ee27cf3, } ;
+
t[0] = k0;
t[1] = k1;
t[2] = k2;
@@ -43,7 +42,7 @@ void WAKE_Base::GenKey(word32 k0, word32 k1, word32 k2, word32 k3) for (p=4 ; p<256 ; p++)
{
x=t[p-4]+t[p-1] ; // fill t
- t[p]= (x>>3) ^ tt[x&7] ;
+ t[p]= (x>>3) ^ TT[x&7] ;
}
for (p=0 ; p<23 ; p++)
|