Move constant table to unnamed namespace
parent
03d78fb783
commit
92163356db
23
wake.cpp
23
wake.cpp
|
|
@ -5,6 +5,15 @@
|
||||||
#include "wake.h"
|
#include "wake.h"
|
||||||
#include "smartptr.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)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#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"
|
// this code is mostly copied from David Wheeler's paper "A Bulk Data Encryption Algorithm"
|
||||||
signed int x, z, p;
|
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[0] = k0;
|
||||||
t[1] = k1;
|
t[1] = k1;
|
||||||
t[2] = k2;
|
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++)
|
for (p=4 ; p<256 ; p++)
|
||||||
{
|
{
|
||||||
x=t[p-4]+t[p-1] ; // fill t
|
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++)
|
for (p=0 ; p<23 ; p++)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue