1
by weidai
Initial revision |
1 |
#ifndef CRYPTOPP_MARS_H
|
2 |
#define CRYPTOPP_MARS_H
|
|
3 |
||
4 |
/** \file
|
|
5 |
*/
|
|
6 |
||
7 |
#include "seckey.h" |
|
8 |
#include "secblock.h" |
|
9 |
||
10 |
NAMESPACE_BEGIN(CryptoPP) |
|
11 |
||
173
by weidai
fix documentation, fix PanamaMAC, fix algorithm names |
12 |
//! _
|
1
by weidai
Initial revision |
13 |
struct MARS_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 56, 4> |
14 |
{
|
|
15 |
static const char *StaticAlgorithmName() {return "MARS";} |
|
16 |
};
|
|
17 |
||
18 |
/// <a href="http://www.weidai.com/scan-mirror/cs.html#MARS">MARS</a>
|
|
19 |
class MARS : public MARS_Info, public BlockCipherDocumentation |
|
20 |
{
|
|
75
by weidai
create DLL version, fix GetNextIV() bug in CTR and OFB modes |
21 |
class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<MARS_Info> |
1
by weidai
Initial revision |
22 |
{
|
23 |
public: |
|
232
by weidai
port to GCC 4, reorganize implementations of SetKey |
24 |
void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); |
1
by weidai
Initial revision |
25 |
|
26 |
protected: |
|
27 |
static const word32 Sbox[512]; |
|
28 |
||
29 |
FixedSizeSecBlock<word32, 40> EK; |
|
30 |
};
|
|
31 |
||
57
by weidai
add CRYPTOPP_NO_VTABLE |
32 |
class CRYPTOPP_NO_VTABLE Enc : public Base |
1
by weidai
Initial revision |
33 |
{
|
34 |
public: |
|
35 |
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; |
|
36 |
};
|
|
37 |
||
57
by weidai
add CRYPTOPP_NO_VTABLE |
38 |
class CRYPTOPP_NO_VTABLE Dec : public Base |
1
by weidai
Initial revision |
39 |
{
|
40 |
public: |
|
41 |
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; |
|
42 |
};
|
|
43 |
||
44 |
public: |
|
75
by weidai
create DLL version, fix GetNextIV() bug in CTR and OFB modes |
45 |
typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption; |
46 |
typedef BlockCipherFinal<DECRYPTION, Dec> Decryption; |
|
1
by weidai
Initial revision |
47 |
};
|
48 |
||
49 |
typedef MARS::Encryption MARSEncryption; |
|
50 |
typedef MARS::Decryption MARSDecryption; |
|
51 |
||
52 |
NAMESPACE_END
|
|
53 |
||
54 |
#endif
|