Crypto++
Main Page
Namespaces
Classes
Files
File List
File Members
square.h
Go to the documentation of this file.
1
#ifndef CRYPTOPP_SQUARE_H
2
#define CRYPTOPP_SQUARE_H
3
4
/** \file
5
*/
6
7
#include "seckey.h"
8
#include "secblock.h"
9
10
NAMESPACE_BEGIN(CryptoPP)
11
12
//! _
13
struct
Square_Info
: public
FixedBlockSize
<16>, public
FixedKeyLength
<16>,
FixedRounds
<8>
14
{
15
static
const
char
*StaticAlgorithmName() {
return
"Square"
;}
16
};
17
18
/// <a href="http://www.weidai.com/scan-mirror/cs.html#Square">Square</a>
19
class
Square
:
public
Square_Info
,
public
BlockCipherDocumentation
20
{
21
class
CRYPTOPP_NO_VTABLE Base :
public
BlockCipherImpl
<Square_Info>
22
{
23
public
:
24
void
UncheckedSetKey(
const
byte *userKey,
unsigned
int
length,
const
NameValuePairs
¶ms);
25
26
protected
:
27
FixedSizeSecBlock<word32, 4*(ROUNDS+1)>
m_roundkeys;
28
};
29
30
class
CRYPTOPP_NO_VTABLE Enc :
public
Base
31
{
32
public
:
33
void
ProcessAndXorBlock(
const
byte *inBlock,
const
byte *xorBlock, byte *outBlock)
const
;
34
private
:
35
static
const
byte Se[256];
36
static
const
word32 Te[4][256];
37
};
38
39
class
CRYPTOPP_NO_VTABLE Dec :
public
Base
40
{
41
public
:
42
void
ProcessAndXorBlock(
const
byte *inBlock,
const
byte *xorBlock, byte *outBlock)
const
;
43
private
:
44
static
const
byte Sd[256];
45
static
const
word32 Td[4][256];
46
};
47
48
public
:
49
typedef
BlockCipherFinal<ENCRYPTION, Enc>
Encryption
;
50
typedef
BlockCipherFinal<DECRYPTION, Dec>
Decryption
;
51
};
52
53
typedef
Square::Encryption
SquareEncryption
;
54
typedef
Square::Decryption
SquareDecryption
;
55
56
NAMESPACE_END
57
58
#endif
Generated on Wed Apr 3 2013 23:04:28 for Crypto++ by
1.8.3.1