cryptopp 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/MIT-LICENSE +22 -0
- data/README +7 -0
- data/Rakefile +42 -0
- data/cryptopp.gemspec +199 -0
- data/ext/.gitignore +5 -0
- data/ext/Rakefile +16 -0
- data/ext/ciphers.cpp +1402 -0
- data/ext/cryptopp.cpp +285 -0
- data/ext/cryptopp_ruby_api.h +139 -0
- data/ext/defs/block_modes.def +10 -0
- data/ext/defs/checksums.def +10 -0
- data/ext/defs/ciphers.def +136 -0
- data/ext/defs/hashes.def +78 -0
- data/ext/defs/hmacs.def +54 -0
- data/ext/defs/paddings.def +9 -0
- data/ext/defs/rngs.def +7 -0
- data/ext/digests.cpp +1120 -0
- data/ext/extconf.rb +39 -0
- data/ext/j3way.cpp +22 -0
- data/ext/j3way.h +29 -0
- data/ext/jadler32.h +32 -0
- data/ext/jaes.cpp +22 -0
- data/ext/jaes.h +31 -0
- data/ext/jarc4.cpp +22 -0
- data/ext/jarc4.h +37 -0
- data/ext/jbase.cpp +172 -0
- data/ext/jbase.h +92 -0
- data/ext/jbasiccipherinfo.h +74 -0
- data/ext/jblowfish.cpp +22 -0
- data/ext/jblowfish.h +29 -0
- data/ext/jcamellia.cpp +24 -0
- data/ext/jcamellia.h +33 -0
- data/ext/jcast128.cpp +22 -0
- data/ext/jcast128.h +31 -0
- data/ext/jcast256.cpp +22 -0
- data/ext/jcast256.h +31 -0
- data/ext/jcipher.cpp +112 -0
- data/ext/jcipher.h +42 -0
- data/ext/jcipher_t.h +469 -0
- data/ext/jconfig.h +127 -0
- data/ext/jconstants.h +189 -0
- data/ext/jcrc32.h +32 -0
- data/ext/jdes.cpp +22 -0
- data/ext/jdes.h +31 -0
- data/ext/jdes_ede2.cpp +22 -0
- data/ext/jdes_ede2.h +31 -0
- data/ext/jdes_ede3.cpp +22 -0
- data/ext/jdes_ede3.h +31 -0
- data/ext/jdes_xex3.cpp +22 -0
- data/ext/jdes_xex3.h +31 -0
- data/ext/jdiamond2.cpp +22 -0
- data/ext/jdiamond2.h +31 -0
- data/ext/jdiamond2lite.cpp +22 -0
- data/ext/jdiamond2lite.h +31 -0
- data/ext/jexception.h +20 -0
- data/ext/jgost.cpp +22 -0
- data/ext/jgost.h +31 -0
- data/ext/jhash.cpp +92 -0
- data/ext/jhash.h +54 -0
- data/ext/jhash_t.h +121 -0
- data/ext/jhaval.h +64 -0
- data/ext/jhelpers.cpp +90 -0
- data/ext/jhelpers.h +38 -0
- data/ext/jhmac.cpp +44 -0
- data/ext/jhmac.h +34 -0
- data/ext/jhmac_t.h +125 -0
- data/ext/jidea.cpp +22 -0
- data/ext/jidea.h +31 -0
- data/ext/jmarc4.cpp +22 -0
- data/ext/jmarc4.h +37 -0
- data/ext/jmars.cpp +22 -0
- data/ext/jmars.h +31 -0
- data/ext/jmd2.h +56 -0
- data/ext/jmd4.h +56 -0
- data/ext/jmd5.h +56 -0
- data/ext/jpanamacipher.cpp +32 -0
- data/ext/jpanamacipher.h +46 -0
- data/ext/jpanamahash.h +44 -0
- data/ext/jrc2.cpp +44 -0
- data/ext/jrc2.h +39 -0
- data/ext/jrc5.cpp +22 -0
- data/ext/jrc5.h +31 -0
- data/ext/jrc6.cpp +22 -0
- data/ext/jrc6.h +31 -0
- data/ext/jripemd160.h +113 -0
- data/ext/jsafer.cpp +32 -0
- data/ext/jsafer.h +42 -0
- data/ext/jseal.cpp +32 -0
- data/ext/jseal.h +42 -0
- data/ext/jserpent.cpp +22 -0
- data/ext/jserpent.h +31 -0
- data/ext/jsha.h +122 -0
- data/ext/jshacal2.cpp +22 -0
- data/ext/jshacal2.h +31 -0
- data/ext/jshark.cpp +24 -0
- data/ext/jshark.h +33 -0
- data/ext/jsink.cpp +90 -0
- data/ext/jsink.h +154 -0
- data/ext/jskipjack.cpp +22 -0
- data/ext/jskipjack.h +31 -0
- data/ext/jsquare.cpp +22 -0
- data/ext/jsquare.h +31 -0
- data/ext/jstream.cpp +8 -0
- data/ext/jstream.h +20 -0
- data/ext/jstream_t.h +175 -0
- data/ext/jtea.cpp +22 -0
- data/ext/jtea.h +31 -0
- data/ext/jtiger.h +52 -0
- data/ext/jtwofish.cpp +22 -0
- data/ext/jtwofish.h +31 -0
- data/ext/jwhirlpool.h +52 -0
- data/ext/utils.cpp +8 -0
- data/extras/parser_c.rb +114 -0
- data/test/ciphers_test.rb +37 -0
- data/test/data/ciphers/3desval.dat +7 -0
- data/test/data/ciphers/3wayval.dat +6 -0
- data/test/data/ciphers/arc4.dat +8 -0
- data/test/data/ciphers/blowfish.dat +5 -0
- data/test/data/ciphers/camellia.dat +7 -0
- data/test/data/ciphers/cast128v.dat +5 -0
- data/test/data/ciphers/cast256v.dat +5 -0
- data/test/data/ciphers/descert.dat +198 -0
- data/test/data/ciphers/diamond.dat +9 -0
- data/test/data/ciphers/gostval.dat +10 -0
- data/test/data/ciphers/ideaval.dat +13 -0
- data/test/data/ciphers/marsval.dat +11 -0
- data/test/data/ciphers/panamac.dat +7 -0
- data/test/data/ciphers/rc2val.dat +10 -0
- data/test/data/ciphers/rc5val.dat +7 -0
- data/test/data/ciphers/rc6val.dat +8 -0
- data/test/data/ciphers/rijndael.dat +11 -0
- data/test/data/ciphers/saferval.dat +27 -0
- data/test/data/ciphers/seal.dat +3 -0
- data/test/data/ciphers/serpentv.dat +11 -0
- data/test/data/ciphers/shacal2.dat +7 -0
- data/test/data/ciphers/sharkval.dat +9 -0
- data/test/data/ciphers/skipjack.dat +3 -0
- data/test/data/ciphers/squareva.dat +10 -0
- data/test/data/ciphers/twofishv.dat +11 -0
- data/test/data/digests/adler32.dat +8 -0
- data/test/data/digests/crc32.dat +10 -0
- data/test/data/digests/haval.dat +4 -0
- data/test/data/digests/havalcer.dat +23 -0
- data/test/data/digests/md2.dat +9 -0
- data/test/data/digests/md4.dat +9 -0
- data/test/data/digests/md5.dat +9 -0
- data/test/data/digests/panamah.dat +8 -0
- data/test/data/digests/ripemd.dat +43 -0
- data/test/data/digests/sha.dat +19 -0
- data/test/data/digests/tiger.dat +11 -0
- data/test/data/digests/whirlpool.dat +13 -0
- data/test/data/hmacs/hmac.dat +6 -0
- data/test/digests_test.rb +29 -0
- data/test/hmacs_test.rb +38 -0
- data/test/test_helper.rb +42 -0
- metadata +220 -0
data/ext/jskipjack.cpp
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (c) 2002-2010 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2010 Wei Dai
|
5
|
+
* See COPYING for the extact license
|
6
|
+
*/
|
7
|
+
|
8
|
+
#include "jskipjack.h"
|
9
|
+
|
10
|
+
#if ENABLED_SKIPJACK_CIPHER
|
11
|
+
|
12
|
+
BlockCipher* JSKIPJACK::getEncryptionObject()
|
13
|
+
{
|
14
|
+
return new SKIPJACKEncryption((byte*) itsKey.data(), itsKeylength);
|
15
|
+
}
|
16
|
+
|
17
|
+
BlockCipher* JSKIPJACK::getDecryptionObject()
|
18
|
+
{
|
19
|
+
return new SKIPJACKDecryption((byte*) itsKey.data(), itsKeylength);
|
20
|
+
}
|
21
|
+
|
22
|
+
#endif
|
data/ext/jskipjack.h
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (c) 2002-2010 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2010 Wei Dai
|
5
|
+
* See COPYING for the extact license
|
6
|
+
*/
|
7
|
+
|
8
|
+
#ifndef __JSKIPJACK_H__
|
9
|
+
#define __JSKIPJACK_H__
|
10
|
+
|
11
|
+
#include "jconfig.h"
|
12
|
+
|
13
|
+
#if ENABLED_SKIPJACK_CIPHER
|
14
|
+
|
15
|
+
#include "jcipher_t.h"
|
16
|
+
|
17
|
+
// Crypto++ headers...
|
18
|
+
|
19
|
+
#include "skipjack.h"
|
20
|
+
|
21
|
+
using namespace CryptoPP;
|
22
|
+
|
23
|
+
class JSKIPJACK : public JCipher_Template<SKIPJACK_Info, SKIPJACK_CIPHER>
|
24
|
+
{
|
25
|
+
protected:
|
26
|
+
BlockCipher* getEncryptionObject();
|
27
|
+
BlockCipher* getDecryptionObject();
|
28
|
+
};
|
29
|
+
|
30
|
+
#endif
|
31
|
+
#endif
|
data/ext/jsquare.cpp
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (c) 2002-2010 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2010 Wei Dai
|
5
|
+
* See COPYING for the extact license
|
6
|
+
*/
|
7
|
+
|
8
|
+
#include "jsquare.h"
|
9
|
+
|
10
|
+
#if ENABLED_SQUARE_CIPHER
|
11
|
+
|
12
|
+
BlockCipher* JSquare::getEncryptionObject()
|
13
|
+
{
|
14
|
+
return new SquareEncryption((byte*) itsKey.data(), itsKeylength);
|
15
|
+
}
|
16
|
+
|
17
|
+
BlockCipher* JSquare::getDecryptionObject()
|
18
|
+
{
|
19
|
+
return new SquareDecryption((byte*) itsKey.data(), itsKeylength);
|
20
|
+
}
|
21
|
+
|
22
|
+
#endif
|
data/ext/jsquare.h
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (c) 2002-2010 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2010 Wei Dai
|
5
|
+
* See COPYING for the extact license
|
6
|
+
*/
|
7
|
+
|
8
|
+
#ifndef __JSQUARE_H__
|
9
|
+
#define __JSQUARE_H__
|
10
|
+
|
11
|
+
#include "jconfig.h"
|
12
|
+
|
13
|
+
#if ENABLED_SQUARE_CIPHER
|
14
|
+
|
15
|
+
#include "jcipher_t.h"
|
16
|
+
|
17
|
+
// Crypto++ headers...
|
18
|
+
|
19
|
+
#include "square.h"
|
20
|
+
|
21
|
+
using namespace CryptoPP;
|
22
|
+
|
23
|
+
class JSquare : public JCipher_Template<Square_Info, SQUARE_CIPHER>
|
24
|
+
{
|
25
|
+
protected:
|
26
|
+
BlockCipher* getEncryptionObject();
|
27
|
+
BlockCipher* getDecryptionObject();
|
28
|
+
};
|
29
|
+
|
30
|
+
#endif
|
31
|
+
#endif
|
data/ext/jstream.cpp
ADDED
data/ext/jstream.h
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (c) 2002-2010 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2010 Wei Dai
|
5
|
+
* See COPYING for the extact license
|
6
|
+
*/
|
7
|
+
|
8
|
+
#ifndef __JSTREAM_H__
|
9
|
+
#define __JSTREAM_H__
|
10
|
+
|
11
|
+
#include "jbase.h"
|
12
|
+
|
13
|
+
// just a little place holder so we can cast
|
14
|
+
// JBase without too much hassle...
|
15
|
+
|
16
|
+
class JStream : public JBase
|
17
|
+
{
|
18
|
+
};
|
19
|
+
|
20
|
+
#endif
|
data/ext/jstream_t.h
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (c) 2002-2010 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2010 Wei Dai
|
5
|
+
* See COPYING for the extact license
|
6
|
+
*/
|
7
|
+
|
8
|
+
#ifndef __JSTREAM_T_H__
|
9
|
+
#define __JSTREAM_T_H__
|
10
|
+
|
11
|
+
#include "jbasiccipherinfo.h"
|
12
|
+
|
13
|
+
template <typename INFO, enum CipherEnum TYPE>
|
14
|
+
class JStream_Template : public JBasicCipherInfo<INFO, JStream>
|
15
|
+
{
|
16
|
+
public:
|
17
|
+
JStream_Template();
|
18
|
+
|
19
|
+
inline enum CipherEnum getCipherType() const;
|
20
|
+
inline unsigned int getBlockSize() const { return 0; }
|
21
|
+
|
22
|
+
bool encrypt();
|
23
|
+
bool decrypt();
|
24
|
+
|
25
|
+
bool encryptRubyIO(VALUE* in, VALUE* out);
|
26
|
+
bool decryptRubyIO(VALUE* in, VALUE* out);
|
27
|
+
|
28
|
+
/* These are deprecated. They were used before using php_streams. Use them
|
29
|
+
if you're using this code in something other than the cryptopp PHP
|
30
|
+
extension...*/
|
31
|
+
// bool encryptFile(const string in, const string out);
|
32
|
+
// bool decryptFile(const string in, const string out);
|
33
|
+
|
34
|
+
protected:
|
35
|
+
virtual SymmetricCipher* getEncryptionObject() = 0;
|
36
|
+
virtual SymmetricCipher* getDecryptionObject() = 0;
|
37
|
+
};
|
38
|
+
|
39
|
+
template <typename INFO, enum CipherEnum TYPE>
|
40
|
+
JStream_Template<INFO, TYPE>::JStream_Template()
|
41
|
+
{
|
42
|
+
this->itsKeylength = INFO::DEFAULT_KEYLENGTH;
|
43
|
+
}
|
44
|
+
|
45
|
+
template <typename INFO, enum CipherEnum TYPE>
|
46
|
+
CipherEnum JStream_Template<INFO, TYPE>::getCipherType() const
|
47
|
+
{
|
48
|
+
return TYPE;
|
49
|
+
}
|
50
|
+
|
51
|
+
template <typename INFO, enum CipherEnum TYPE>
|
52
|
+
bool JStream_Template<INFO, TYPE>::encrypt()
|
53
|
+
{
|
54
|
+
StreamTransformation* cipher = NULL;
|
55
|
+
|
56
|
+
cipher = getEncryptionObject();
|
57
|
+
|
58
|
+
if (cipher != NULL) {
|
59
|
+
this->itsCiphertext.erase();
|
60
|
+
StringSource(this->itsPlaintext, true, new StreamTransformationFilter(*cipher, new StringSink(this->itsCiphertext)));
|
61
|
+
delete cipher;
|
62
|
+
return true;
|
63
|
+
}
|
64
|
+
else {
|
65
|
+
return false;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
template <typename INFO, enum CipherEnum TYPE>
|
70
|
+
bool JStream_Template<INFO, TYPE>::decrypt()
|
71
|
+
{
|
72
|
+
StreamTransformation* cipher = NULL;
|
73
|
+
|
74
|
+
cipher = getDecryptionObject();
|
75
|
+
|
76
|
+
if (cipher != NULL) {
|
77
|
+
this->itsPlaintext.erase();
|
78
|
+
StringSource(this->itsCiphertext, true, new StreamTransformationFilter(*cipher, new StringSink(this->itsPlaintext)));
|
79
|
+
delete cipher;
|
80
|
+
return true;
|
81
|
+
}
|
82
|
+
else {
|
83
|
+
return false;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
template <typename INFO, enum CipherEnum TYPE>
|
88
|
+
bool JStream_Template<INFO, TYPE>::encryptRubyIO(VALUE* in, VALUE* out)
|
89
|
+
{
|
90
|
+
StreamTransformation* cipher = NULL;
|
91
|
+
|
92
|
+
cipher = getEncryptionObject();
|
93
|
+
|
94
|
+
if (cipher != NULL) {
|
95
|
+
try {
|
96
|
+
RubyIOSource(&in, true, new StreamTransformationFilter(*cipher, new RubyIOSink(&out)));
|
97
|
+
}
|
98
|
+
catch (RubyIOStore::OpenErr e) {
|
99
|
+
delete cipher;
|
100
|
+
throw e;
|
101
|
+
}
|
102
|
+
delete cipher;
|
103
|
+
}
|
104
|
+
|
105
|
+
return true;
|
106
|
+
}
|
107
|
+
|
108
|
+
template <typename INFO, enum CipherEnum TYPE>
|
109
|
+
bool JStream_Template<INFO, TYPE>::decryptRubyIO(VALUE* in, VALUE* out)
|
110
|
+
{
|
111
|
+
StreamTransformation* cipher = NULL;
|
112
|
+
|
113
|
+
cipher = getDecryptionObject();
|
114
|
+
|
115
|
+
if (cipher != NULL) {
|
116
|
+
try {
|
117
|
+
RubyIOSource(&in, true, new StreamTransformationFilter(*cipher, new RubyIOSink(&out)));
|
118
|
+
}
|
119
|
+
catch (RubyIOStore::OpenErr e) {
|
120
|
+
delete cipher;
|
121
|
+
throw e;
|
122
|
+
}
|
123
|
+
delete cipher;
|
124
|
+
}
|
125
|
+
|
126
|
+
return true;
|
127
|
+
}
|
128
|
+
|
129
|
+
/* These are deprecated. They were used before using php_streams. Use them
|
130
|
+
if you're using this code in something other than the cryptopp PHP
|
131
|
+
extension... */
|
132
|
+
/*template <typename INFO, enum CipherEnum TYPE>
|
133
|
+
bool JStream_Template<INFO, TYPE>::encryptFile(const string in, const string out)
|
134
|
+
{
|
135
|
+
StreamTransformation* cipher = NULL;
|
136
|
+
|
137
|
+
cipher = getEncryptionObject();
|
138
|
+
|
139
|
+
if (cipher != NULL) {
|
140
|
+
try {
|
141
|
+
FileSource(in.c_str(), true, new StreamTransformationFilter(*cipher, new FileSink(out.c_str())));
|
142
|
+
}
|
143
|
+
catch (FileStore::OpenErr e) {
|
144
|
+
delete cipher;
|
145
|
+
throw e;
|
146
|
+
}
|
147
|
+
delete cipher;
|
148
|
+
}
|
149
|
+
|
150
|
+
return true;
|
151
|
+
}
|
152
|
+
|
153
|
+
template <typename INFO, enum CipherEnum TYPE>
|
154
|
+
bool JStream_Template<INFO, TYPE>::decryptFile(const string in, const string out)
|
155
|
+
{
|
156
|
+
StreamTransformation* cipher = NULL;
|
157
|
+
|
158
|
+
cipher = getDecryptionObject();
|
159
|
+
|
160
|
+
if (cipher != NULL) {
|
161
|
+
try {
|
162
|
+
FileSource(in.c_str(), true, new StreamTransformationFilter(*cipher, new FileSink(out.c_str())));
|
163
|
+
}
|
164
|
+
catch (FileStore::OpenErr e) {
|
165
|
+
delete cipher;
|
166
|
+
throw e;
|
167
|
+
}
|
168
|
+
delete cipher;
|
169
|
+
}
|
170
|
+
|
171
|
+
return true;
|
172
|
+
}
|
173
|
+
*/
|
174
|
+
|
175
|
+
#endif
|
data/ext/jtea.cpp
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (c) 2002-2010 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2010 Wei Dai
|
5
|
+
* See COPYING for the extact license
|
6
|
+
*/
|
7
|
+
|
8
|
+
#include "jtea.h"
|
9
|
+
|
10
|
+
#if ENABLED_TEA_CIPHER
|
11
|
+
|
12
|
+
BlockCipher* JTEA::getEncryptionObject()
|
13
|
+
{
|
14
|
+
return new TEAEncryption((byte*) itsKey.data(), itsKeylength);
|
15
|
+
}
|
16
|
+
|
17
|
+
BlockCipher* JTEA::getDecryptionObject()
|
18
|
+
{
|
19
|
+
return new TEADecryption((byte*) itsKey.data(), itsKeylength);
|
20
|
+
}
|
21
|
+
|
22
|
+
#endif
|
data/ext/jtea.h
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (c) 2002-2010 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2010 Wei Dai
|
5
|
+
* See COPYING for the extact license
|
6
|
+
*/
|
7
|
+
|
8
|
+
#ifndef __JTEA_H__
|
9
|
+
#define __JTEA_H__
|
10
|
+
|
11
|
+
#include "jconfig.h"
|
12
|
+
|
13
|
+
#if ENABLED_TEA_CIPHER
|
14
|
+
|
15
|
+
#include "jcipher_t.h"
|
16
|
+
|
17
|
+
// Crypto++ headers...
|
18
|
+
|
19
|
+
#include "tea.h"
|
20
|
+
|
21
|
+
using namespace CryptoPP;
|
22
|
+
|
23
|
+
class JTEA : public JCipher_Template<TEA_Info, TEA_CIPHER>
|
24
|
+
{
|
25
|
+
protected:
|
26
|
+
BlockCipher* getEncryptionObject();
|
27
|
+
BlockCipher* getDecryptionObject();
|
28
|
+
};
|
29
|
+
|
30
|
+
#endif
|
31
|
+
#endif
|
data/ext/jtiger.h
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (c) 2002-2010 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2010 Wei Dai
|
5
|
+
* See COPYING for the extact license
|
6
|
+
*/
|
7
|
+
|
8
|
+
#ifndef __JTIGER_H__
|
9
|
+
#define __JTIGER_H__
|
10
|
+
|
11
|
+
#include "jconfig.h"
|
12
|
+
|
13
|
+
#ifdef WORD64_AVAILABLE
|
14
|
+
#if ENABLED_TIGER_HASH || ENABLED_TIGER_HMAC
|
15
|
+
|
16
|
+
#if ENABLED_TIGER_HASH
|
17
|
+
#include "jhash_t.h"
|
18
|
+
#endif
|
19
|
+
|
20
|
+
#if ENABLED_TIGER_HMAC
|
21
|
+
#include "jhmac_t.h"
|
22
|
+
#endif
|
23
|
+
|
24
|
+
// Crypto++ headers...
|
25
|
+
|
26
|
+
#include "tiger.h"
|
27
|
+
|
28
|
+
using namespace CryptoPP;
|
29
|
+
|
30
|
+
#if ENABLED_TIGER_HASH
|
31
|
+
class JTiger : public JHash_Template<Tiger, TIGER_HASH>
|
32
|
+
{
|
33
|
+
public:
|
34
|
+
JTiger(string plaintext = "") : JHash_Template<Tiger, TIGER_HASH>(plaintext) { }
|
35
|
+
|
36
|
+
static string getHashName() { return "Tiger"; }
|
37
|
+
};
|
38
|
+
#endif
|
39
|
+
|
40
|
+
#if ENABLED_TIGER_HMAC
|
41
|
+
class JTiger_HMAC : public JHMAC_Template<Tiger, TIGER_HMAC>
|
42
|
+
{
|
43
|
+
public:
|
44
|
+
JTiger_HMAC(string plaintext = "") : JHMAC_Template<Tiger, TIGER_HMAC>(plaintext) { }
|
45
|
+
|
46
|
+
static string getHashName() { return "Tiger HMAC"; }
|
47
|
+
};
|
48
|
+
#endif
|
49
|
+
|
50
|
+
#endif
|
51
|
+
#endif
|
52
|
+
#endif
|
data/ext/jtwofish.cpp
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (c) 2002-2010 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2010 Wei Dai
|
5
|
+
* See COPYING for the extact license
|
6
|
+
*/
|
7
|
+
|
8
|
+
#include "jtwofish.h"
|
9
|
+
|
10
|
+
#if ENABLED_TWOFISH_CIPHER
|
11
|
+
|
12
|
+
BlockCipher* JTwofish::getEncryptionObject()
|
13
|
+
{
|
14
|
+
return new TwofishEncryption((byte*) itsKey.data(), itsKeylength);
|
15
|
+
}
|
16
|
+
|
17
|
+
BlockCipher* JTwofish::getDecryptionObject()
|
18
|
+
{
|
19
|
+
return new TwofishDecryption((byte*) itsKey.data(), itsKeylength);
|
20
|
+
}
|
21
|
+
|
22
|
+
#endif
|