cryptopp 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/Gemfile +14 -0
- data/Guardfile +17 -0
- data/MIT-LICENSE +1 -1
- data/Rakefile +20 -27
- data/VERSION +1 -0
- data/cryptopp.gemspec +7 -182
- data/ext/Rakefile +2 -2
- data/ext/ciphers.cpp +619 -619
- data/ext/cryptopp.cpp +220 -217
- data/ext/cryptopp_ruby_api.h +7 -7
- data/ext/defs/hashes.def +16 -0
- data/ext/defs/hmacs.def +16 -0
- data/ext/digests.cpp +635 -601
- data/ext/extconf.rb +61 -19
- data/ext/j3way.cpp +5 -5
- data/ext/j3way.h +6 -6
- data/ext/jadler32.h +6 -6
- data/ext/jaes.cpp +5 -5
- data/ext/jaes.h +6 -6
- data/ext/jarc4.cpp +5 -5
- data/ext/jarc4.h +6 -6
- data/ext/jbase.cpp +94 -94
- data/ext/jbase.h +49 -55
- data/ext/jbasiccipherinfo.h +23 -23
- data/ext/jblowfish.cpp +5 -5
- data/ext/jblowfish.h +6 -6
- data/ext/jcamellia.cpp +5 -7
- data/ext/jcamellia.h +6 -8
- data/ext/jcast128.cpp +5 -5
- data/ext/jcast128.h +6 -6
- data/ext/jcast256.cpp +5 -5
- data/ext/jcast256.h +6 -6
- data/ext/jcipher.cpp +62 -62
- data/ext/jcipher.h +24 -24
- data/ext/jcipher_t.h +383 -383
- data/ext/jconfig.h +29 -46
- data/ext/jconstants.h +120 -122
- data/ext/jcrc32.h +6 -6
- data/ext/jdes.cpp +5 -5
- data/ext/jdes.h +6 -6
- data/ext/jdes_ede2.cpp +5 -5
- data/ext/jdes_ede2.h +6 -6
- data/ext/jdes_ede3.cpp +5 -5
- data/ext/jdes_ede3.h +6 -6
- data/ext/jdes_xex3.cpp +5 -5
- data/ext/jdes_xex3.h +6 -6
- data/ext/jdiamond2.cpp +5 -5
- data/ext/jdiamond2.h +6 -6
- data/ext/jdiamond2lite.cpp +5 -5
- data/ext/jdiamond2lite.h +6 -6
- data/ext/jexception.h +5 -5
- data/ext/jgost.cpp +5 -5
- data/ext/jgost.h +6 -6
- data/ext/jhash.cpp +51 -51
- data/ext/jhash.h +22 -27
- data/ext/jhash_t.h +59 -59
- data/ext/jhaval.h +15 -15
- data/ext/jhelpers.cpp +54 -54
- data/ext/jhelpers.h +3 -3
- data/ext/jhmac.cpp +20 -20
- data/ext/jhmac.h +15 -15
- data/ext/jhmac_t.h +40 -72
- data/ext/jidea.cpp +5 -5
- data/ext/jidea.h +6 -6
- data/ext/jmarc4.cpp +5 -5
- data/ext/jmarc4.h +6 -6
- data/ext/jmars.cpp +5 -5
- data/ext/jmars.h +6 -6
- data/ext/jmd2.h +9 -9
- data/ext/jmd4.h +9 -9
- data/ext/jmd5.h +9 -9
- data/ext/jpanamacipher.cpp +7 -7
- data/ext/jpanamacipher.h +9 -9
- data/ext/jpanamahash.h +9 -9
- data/ext/jrc2.cpp +15 -15
- data/ext/jrc2.h +11 -11
- data/ext/jrc5.cpp +5 -5
- data/ext/jrc5.h +6 -6
- data/ext/jrc6.cpp +5 -5
- data/ext/jrc6.h +6 -6
- data/ext/jripemd160.h +28 -28
- data/ext/jsafer.cpp +7 -7
- data/ext/jsafer.h +9 -9
- data/ext/jseal.cpp +7 -7
- data/ext/jseal.h +9 -9
- data/ext/jserpent.cpp +5 -5
- data/ext/jserpent.h +6 -6
- data/ext/jsha.h +38 -37
- data/ext/jsha3.h +130 -0
- data/ext/jsha3_blocksizes.h +73 -0
- data/ext/jshacal2.cpp +5 -5
- data/ext/jshacal2.h +6 -6
- data/ext/jshark.cpp +5 -7
- data/ext/jshark.h +6 -8
- data/ext/jsink.cpp +57 -57
- data/ext/jsink.h +127 -123
- data/ext/jskipjack.cpp +5 -5
- data/ext/jskipjack.h +6 -6
- data/ext/jsquare.cpp +5 -5
- data/ext/jsquare.h +6 -6
- data/ext/jstream.cpp +3 -3
- data/ext/jstream.h +3 -3
- data/ext/jstream_t.h +74 -126
- data/ext/jtea.cpp +5 -5
- data/ext/jtea.h +6 -6
- data/ext/jtiger.h +9 -11
- data/ext/jtwofish.cpp +5 -5
- data/ext/jtwofish.h +6 -6
- data/ext/jwhirlpool.h +9 -11
- data/ext/utils.cpp +3 -3
- data/extras/parser_c.rb +102 -102
- data/test/ciphers_test.rb +24 -30
- data/test/data/ciphers/3desval.yml +13 -0
- data/test/data/ciphers/3wayval.yml +17 -0
- data/test/data/ciphers/arc4.yml +22 -0
- data/test/data/ciphers/blowfish.yml +9 -0
- data/test/data/ciphers/camellia.yml +21 -0
- data/test/data/ciphers/cast128v.yml +13 -0
- data/test/data/ciphers/cast256v.yml +13 -0
- data/test/data/ciphers/descert.yml +723 -0
- data/test/data/ciphers/diamond.yml +31 -0
- data/test/data/ciphers/gostval.yml +33 -0
- data/test/data/ciphers/ideaval.yml +45 -0
- data/test/data/ciphers/marsval.yml +37 -0
- data/test/data/ciphers/panamac.yml +11 -0
- data/test/data/ciphers/rc2val.yml +49 -0
- data/test/data/ciphers/rc5val.yml +26 -0
- data/test/data/ciphers/rc6val.yml +25 -0
- data/test/data/ciphers/rijndael.yml +37 -0
- data/test/data/ciphers/saferval.yml +77 -0
- data/test/data/ciphers/seal.yml +6 -0
- data/test/data/ciphers/serpentv.yml +37 -0
- data/test/data/ciphers/shacal2.yml +21 -0
- data/test/data/ciphers/sharkval.yml +29 -0
- data/test/data/ciphers/skipjack.yml +5 -0
- data/test/data/ciphers/squareva.yml +33 -0
- data/test/data/ciphers/twofishv.yml +37 -0
- data/test/data/digests/adler32.yml +19 -0
- data/test/data/digests/crc32.yml +25 -0
- data/test/data/digests/haval.yml +7 -0
- data/test/data/digests/havalcer.yml +1 -0
- data/test/data/digests/md2.yml +22 -0
- data/test/data/digests/md4.yml +22 -0
- data/test/data/digests/md5.yml +22 -0
- data/test/data/digests/panamah.yml +13 -0
- data/test/data/digests/ripemd.yml +97 -0
- data/test/data/digests/sha.yml +25 -0
- data/test/data/digests/sha3.yml +23 -0
- data/test/data/digests/tiger.yml +30 -0
- data/test/data/digests/whirlpool.yml +25 -0
- data/test/data/hmacs/hmac.yml +14 -0
- data/test/digests_test.rb +17 -23
- data/test/hmacs_test.rb +25 -31
- data/test/test_helper.rb +31 -37
- metadata +70 -82
- data/test/data/ciphers/3desval.dat +0 -7
- data/test/data/ciphers/3wayval.dat +0 -6
- data/test/data/ciphers/arc4.dat +0 -8
- data/test/data/ciphers/blowfish.dat +0 -5
- data/test/data/ciphers/camellia.dat +0 -7
- data/test/data/ciphers/cast128v.dat +0 -5
- data/test/data/ciphers/cast256v.dat +0 -5
- data/test/data/ciphers/descert.dat +0 -198
- data/test/data/ciphers/diamond.dat +0 -9
- data/test/data/ciphers/gostval.dat +0 -10
- data/test/data/ciphers/ideaval.dat +0 -13
- data/test/data/ciphers/marsval.dat +0 -11
- data/test/data/ciphers/panamac.dat +0 -7
- data/test/data/ciphers/rc2val.dat +0 -10
- data/test/data/ciphers/rc5val.dat +0 -7
- data/test/data/ciphers/rc6val.dat +0 -8
- data/test/data/ciphers/rijndael.dat +0 -11
- data/test/data/ciphers/saferval.dat +0 -27
- data/test/data/ciphers/seal.dat +0 -3
- data/test/data/ciphers/serpentv.dat +0 -11
- data/test/data/ciphers/shacal2.dat +0 -7
- data/test/data/ciphers/sharkval.dat +0 -9
- data/test/data/ciphers/skipjack.dat +0 -3
- data/test/data/ciphers/squareva.dat +0 -10
- data/test/data/ciphers/twofishv.dat +0 -11
- data/test/data/digests/adler32.dat +0 -8
- data/test/data/digests/crc32.dat +0 -10
- data/test/data/digests/haval.dat +0 -4
- data/test/data/digests/havalcer.dat +0 -23
- data/test/data/digests/md2.dat +0 -9
- data/test/data/digests/md4.dat +0 -9
- data/test/data/digests/md5.dat +0 -9
- data/test/data/digests/panamah.dat +0 -8
- data/test/data/digests/ripemd.dat +0 -43
- data/test/data/digests/sha.dat +0 -19
- data/test/data/digests/tiger.dat +0 -11
- data/test/data/digests/whirlpool.dat +0 -13
- data/test/data/hmacs/hmac.dat +0 -6
data/ext/jhmac.cpp
CHANGED
@@ -1,44 +1,44 @@
|
|
1
1
|
|
2
2
|
/*
|
3
|
-
* Copyright (c) 2002-
|
4
|
-
* Crypto++ copyright (c) 1995-
|
5
|
-
* See
|
3
|
+
* Copyright (c) 2002-2014 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2013 Wei Dai
|
5
|
+
* See MIT-LICENSE for the extact license
|
6
6
|
*/
|
7
7
|
|
8
8
|
#include "jhmac.h"
|
9
9
|
|
10
10
|
unsigned int JHMAC::getKeylength() const
|
11
11
|
{
|
12
|
-
|
12
|
+
return itsKeylength;
|
13
13
|
}
|
14
14
|
|
15
15
|
string JHMAC::getKey(const bool hex) const
|
16
16
|
{
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
if (hex) {
|
18
|
+
return bin2hex(itsKey);
|
19
|
+
}
|
20
|
+
else {
|
21
|
+
return itsKey;
|
22
|
+
}
|
23
23
|
}
|
24
24
|
|
25
25
|
unsigned int JHMAC::setKeylength(const unsigned int keylength)
|
26
26
|
{
|
27
|
-
|
27
|
+
itsKeylength = checkBounds(keylength, 0, UINT_MAX);
|
28
28
|
|
29
|
-
|
29
|
+
return itsKeylength;
|
30
30
|
}
|
31
31
|
|
32
32
|
unsigned int JHMAC::setKey(const string key, const bool hex)
|
33
33
|
{
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
if (hex) {
|
35
|
+
itsKey = hex2bin(key);
|
36
|
+
}
|
37
|
+
else {
|
38
|
+
itsKey = key;
|
39
|
+
}
|
40
40
|
|
41
|
-
|
41
|
+
itsKey.resize(setKeylength(itsKey.length()));
|
42
42
|
|
43
|
-
|
43
|
+
return itsKeylength;
|
44
44
|
}
|
data/ext/jhmac.h
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
/*
|
3
|
-
* Copyright (c) 2002-
|
4
|
-
* Crypto++ copyright (c) 1995-
|
5
|
-
* See
|
3
|
+
* Copyright (c) 2002-2014 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2013 Wei Dai
|
5
|
+
* See MIT-LICENSE for the extact license
|
6
6
|
*/
|
7
7
|
|
8
8
|
#ifndef __JHMAC_H__
|
@@ -14,21 +14,21 @@ using namespace CryptoPP;
|
|
14
14
|
|
15
15
|
class JHMAC : public JHash
|
16
16
|
{
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
public:
|
18
|
+
JHMAC(string plaintext = "") : JHash(plaintext)
|
19
|
+
{
|
20
|
+
itsKeylength = 16;
|
21
|
+
}
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
unsigned int getKeylength() const;
|
24
|
+
string getKey(const bool hex = false) const;
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
unsigned int setKeylength(const unsigned int keylength);
|
27
|
+
unsigned int setKey(const string key, const bool hex = false);
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
protected:
|
30
|
+
string itsKey;
|
31
|
+
unsigned int itsKeylength;
|
32
32
|
};
|
33
33
|
|
34
34
|
#endif
|
data/ext/jhmac_t.h
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
/*
|
3
|
-
* Copyright (c) 2002-
|
4
|
-
* Crypto++ copyright (c) 1995-
|
5
|
-
* See
|
3
|
+
* Copyright (c) 2002-2014 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2013 Wei Dai
|
5
|
+
* See MIT-LICENSE for the extact license
|
6
6
|
*/
|
7
7
|
|
8
8
|
#ifndef __JHMAC_T_H__
|
@@ -19,107 +19,75 @@ using namespace CryptoPP;
|
|
19
19
|
template <typename HASH, enum HashEnum TYPE>
|
20
20
|
class JHMAC_Template : public JHMAC
|
21
21
|
{
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
/* This is deprecated. It was used before using php_streams. Use it
|
31
|
-
if you're using this code in something other than the cryptopp PHP
|
32
|
-
extension...*/
|
33
|
-
//string hashFile(const string filename, bool hex = true);
|
22
|
+
public:
|
23
|
+
JHMAC_Template(string plaintext = "");
|
24
|
+
inline enum HashEnum getHashType() const;
|
25
|
+
bool hash();
|
26
|
+
bool validate();
|
27
|
+
bool validate(string plaintext, string hashtext);
|
28
|
+
string hashRubyIO(VALUE* in, bool hex = true);
|
34
29
|
};
|
35
30
|
|
36
31
|
template <typename HASH, enum HashEnum TYPE>
|
37
32
|
JHMAC_Template<HASH, TYPE>::JHMAC_Template(string plaintext) : JHMAC(plaintext)
|
38
33
|
{
|
39
|
-
|
34
|
+
itsHashModule = new HMAC<HASH>;
|
40
35
|
}
|
41
36
|
|
42
37
|
template <typename HASH, enum HashEnum TYPE>
|
43
38
|
HashEnum JHMAC_Template<HASH, TYPE>::getHashType() const
|
44
39
|
{
|
45
|
-
|
40
|
+
return TYPE;
|
46
41
|
}
|
47
42
|
|
48
43
|
template <typename HASH, enum HashEnum TYPE>
|
49
44
|
bool JHMAC_Template<HASH, TYPE>::hash()
|
50
45
|
{
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
46
|
+
((HMAC<HASH>*) itsHashModule)->SetKey((byte*) itsKey.data(), itsKeylength);
|
47
|
+
itsHashtext.erase();
|
48
|
+
StringSource s(itsPlaintext, true, new HashFilter(*itsHashModule, new StringSink(itsHashtext)));
|
49
|
+
return true;
|
55
50
|
}
|
56
51
|
|
57
52
|
template <typename HASH, enum HashEnum TYPE>
|
58
53
|
bool JHMAC_Template<HASH, TYPE>::validate()
|
59
54
|
{
|
60
|
-
|
55
|
+
return validate(itsPlaintext, itsHashtext);
|
61
56
|
}
|
62
57
|
|
63
58
|
template <typename HASH, enum HashEnum TYPE>
|
64
59
|
bool JHMAC_Template<HASH, TYPE>::validate(string plaintext, string hashtext)
|
65
60
|
{
|
66
|
-
|
67
|
-
|
68
|
-
|
61
|
+
if (itsHashModule == NULL) {
|
62
|
+
throw;
|
63
|
+
}
|
69
64
|
|
70
|
-
|
65
|
+
((HMAC<HASH>*) itsHashModule)->SetKey((byte*) itsKey.data(), itsKeylength);
|
71
66
|
|
72
|
-
|
67
|
+
return itsHashModule->VerifyDigest((const byte*) hashtext.data(), (const byte*) plaintext.data(), plaintext.length());
|
73
68
|
}
|
74
69
|
|
75
70
|
template <typename HASH, enum HashEnum TYPE>
|
76
71
|
string JHMAC_Template<HASH, TYPE>::hashRubyIO(VALUE* in, bool hex)
|
77
72
|
{
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
73
|
+
if (itsHashModule == NULL) {
|
74
|
+
throw;
|
75
|
+
}
|
76
|
+
|
77
|
+
((HMAC<HASH>*) itsHashModule)->SetKey((byte*) itsKey.data(), itsKeylength);
|
78
|
+
string retval;
|
79
|
+
try {
|
80
|
+
if (hex) {
|
81
|
+
RubyIOSource f(&in, true, new HashFilter(*itsHashModule, new HexEncoder(new StringSink(retval), false)));
|
82
|
+
}
|
83
|
+
else {
|
84
|
+
RubyIOSource f(&in, true, new HashFilter(*itsHashModule, new StringSink(retval)));
|
85
|
+
}
|
86
|
+
}
|
87
|
+
catch (Exception e) {
|
88
|
+
throw e;
|
89
|
+
}
|
90
|
+
return retval;
|
96
91
|
}
|
97
92
|
|
98
|
-
|
99
|
-
/* This is deprecated. It was used before using php_streams. Use it
|
100
|
-
if you're using this code in something other than the cryptopp PHP
|
101
|
-
extension... */
|
102
|
-
/*template <typename HASH, enum HashEnum TYPE>
|
103
|
-
string JHMAC_Template<HASH, TYPE>::hashFile(const string filename, bool hex)
|
104
|
-
{
|
105
|
-
if (itsHashModule == NULL) {
|
106
|
-
throw;
|
107
|
-
}
|
108
|
-
|
109
|
-
((HMAC<HASH>*) itsHashModule)->SetKey((byte*) itsKey.data(), itsKeylength);
|
110
|
-
string retval;
|
111
|
-
try {
|
112
|
-
if (hex) {
|
113
|
-
FileSource f(filename.c_str(), true, new HashFilter(*itsHashModule, new HexEncoder(new StringSink(retval), false)));
|
114
|
-
}
|
115
|
-
else {
|
116
|
-
FileSource f(filename.c_str(), true, new HashFilter(*itsHashModule, new StringSink(retval)));
|
117
|
-
}
|
118
|
-
}
|
119
|
-
catch (FileStore::OpenErr e) {
|
120
|
-
throw e;
|
121
|
-
}
|
122
|
-
return retval;
|
123
|
-
}*/
|
124
|
-
|
125
93
|
#endif
|
data/ext/jidea.cpp
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
/*
|
3
|
-
* Copyright (c) 2002-
|
4
|
-
* Crypto++ copyright (c) 1995-
|
5
|
-
* See
|
3
|
+
* Copyright (c) 2002-2014 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2013 Wei Dai
|
5
|
+
* See MIT-LICENSE for the extact license
|
6
6
|
*/
|
7
7
|
|
8
8
|
#include "jidea.h"
|
@@ -11,12 +11,12 @@
|
|
11
11
|
|
12
12
|
BlockCipher* JIDEA::getEncryptionObject()
|
13
13
|
{
|
14
|
-
|
14
|
+
return new IDEAEncryption((byte*) itsKey.data(), itsKeylength);
|
15
15
|
}
|
16
16
|
|
17
17
|
BlockCipher* JIDEA::getDecryptionObject()
|
18
18
|
{
|
19
|
-
|
19
|
+
return new IDEADecryption((byte*) itsKey.data(), itsKeylength);
|
20
20
|
}
|
21
21
|
|
22
22
|
#endif
|
data/ext/jidea.h
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
/*
|
3
|
-
* Copyright (c) 2002-
|
4
|
-
* Crypto++ copyright (c) 1995-
|
5
|
-
* See
|
3
|
+
* Copyright (c) 2002-2014 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2013 Wei Dai
|
5
|
+
* See MIT-LICENSE for the extact license
|
6
6
|
*/
|
7
7
|
|
8
8
|
#ifndef __JIDEA_H__
|
@@ -22,9 +22,9 @@ using namespace CryptoPP;
|
|
22
22
|
|
23
23
|
class JIDEA : public JCipher_Template<IDEA_Info, IDEA_CIPHER>
|
24
24
|
{
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
protected:
|
26
|
+
BlockCipher* getEncryptionObject();
|
27
|
+
BlockCipher* getDecryptionObject();
|
28
28
|
};
|
29
29
|
|
30
30
|
#endif
|
data/ext/jmarc4.cpp
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
/*
|
3
|
-
* Copyright (c) 2002-
|
4
|
-
* Crypto++ copyright (c) 1995-
|
5
|
-
* See
|
3
|
+
* Copyright (c) 2002-2014 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2013 Wei Dai
|
5
|
+
* See MIT-LICENSE for the extact license
|
6
6
|
*/
|
7
7
|
|
8
8
|
#include "jmarc4.h"
|
@@ -11,12 +11,12 @@
|
|
11
11
|
|
12
12
|
SymmetricCipher* JMARC4::getEncryptionObject()
|
13
13
|
{
|
14
|
-
|
14
|
+
return new Weak::MARC4((byte*) itsKey.data(), itsKeylength);
|
15
15
|
}
|
16
16
|
|
17
17
|
SymmetricCipher* JMARC4::getDecryptionObject()
|
18
18
|
{
|
19
|
-
|
19
|
+
return getEncryptionObject();
|
20
20
|
}
|
21
21
|
|
22
22
|
#endif
|
data/ext/jmarc4.h
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
/*
|
3
|
-
* Copyright (c) 2002-
|
4
|
-
* Crypto++ copyright (c) 1995-
|
5
|
-
* See
|
3
|
+
* Copyright (c) 2002-2014 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2013 Wei Dai
|
5
|
+
* See MIT-LICENSE for the extact license
|
6
6
|
*/
|
7
7
|
|
8
8
|
#ifndef __JMARC4_H__
|
@@ -26,9 +26,9 @@ using namespace CryptoPP;
|
|
26
26
|
|
27
27
|
class JMARC4 : public JStream_Template<Weak::MARC4_Base, MARC4_CIPHER>
|
28
28
|
{
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
protected:
|
30
|
+
SymmetricCipher* getEncryptionObject();
|
31
|
+
SymmetricCipher* getDecryptionObject();
|
32
32
|
};
|
33
33
|
|
34
34
|
#undef CRYPTOPP_ENABLE_NAMESPACE_WEAK
|
data/ext/jmars.cpp
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
/*
|
3
|
-
* Copyright (c) 2002-
|
4
|
-
* Crypto++ copyright (c) 1995-
|
5
|
-
* See
|
3
|
+
* Copyright (c) 2002-2014 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2013 Wei Dai
|
5
|
+
* See MIT-LICENSE for the extact license
|
6
6
|
*/
|
7
7
|
|
8
8
|
#include "jmars.h"
|
@@ -11,12 +11,12 @@
|
|
11
11
|
|
12
12
|
BlockCipher* JMARS::getEncryptionObject()
|
13
13
|
{
|
14
|
-
|
14
|
+
return new MARSEncryption((byte*) itsKey.data(), itsKeylength);
|
15
15
|
}
|
16
16
|
|
17
17
|
BlockCipher* JMARS::getDecryptionObject()
|
18
18
|
{
|
19
|
-
|
19
|
+
return new MARSDecryption((byte*) itsKey.data(), itsKeylength);
|
20
20
|
}
|
21
21
|
|
22
22
|
#endif
|
data/ext/jmars.h
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
/*
|
3
|
-
* Copyright (c) 2002-
|
4
|
-
* Crypto++ copyright (c) 1995-
|
5
|
-
* See
|
3
|
+
* Copyright (c) 2002-2014 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2013 Wei Dai
|
5
|
+
* See MIT-LICENSE for the extact license
|
6
6
|
*/
|
7
7
|
|
8
8
|
#ifndef __JMARS_H__
|
@@ -22,9 +22,9 @@ using namespace CryptoPP;
|
|
22
22
|
|
23
23
|
class JMARS : public JCipher_Template<MARS_Info, MARS_CIPHER>
|
24
24
|
{
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
protected:
|
26
|
+
BlockCipher* getEncryptionObject();
|
27
|
+
BlockCipher* getDecryptionObject();
|
28
28
|
};
|
29
29
|
|
30
30
|
#endif
|
data/ext/jmd2.h
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
/*
|
3
|
-
* Copyright (c) 2002-
|
4
|
-
* Crypto++ copyright (c) 1995-
|
5
|
-
* See
|
3
|
+
* Copyright (c) 2002-2014 J Smith <dark.panda@gmail.com>
|
4
|
+
* Crypto++ copyright (c) 1995-2013 Wei Dai
|
5
|
+
* See MIT-LICENSE for the extact license
|
6
6
|
*/
|
7
7
|
|
8
8
|
#ifndef __JMD2_H__
|
@@ -33,20 +33,20 @@ using namespace CryptoPP;
|
|
33
33
|
#if ENABLED_MD2_HASH
|
34
34
|
class JMD2 : public JHash_Template<Weak::MD2, MD2_HASH>
|
35
35
|
{
|
36
|
-
|
37
|
-
|
36
|
+
public:
|
37
|
+
JMD2(string plaintext = "") : JHash_Template<Weak::MD2, MD2_HASH>(plaintext) { }
|
38
38
|
|
39
|
-
|
39
|
+
static string getHashName() { return "MD2"; }
|
40
40
|
};
|
41
41
|
#endif
|
42
42
|
|
43
43
|
#if ENABLED_MD5_HMAC
|
44
44
|
class JMD2_HMAC : public JHMAC_Template<Weak::MD2, MD2_HMAC>
|
45
45
|
{
|
46
|
-
|
47
|
-
|
46
|
+
public:
|
47
|
+
JMD2_HMAC(string plaintext = "") : JHMAC_Template<Weak::MD2, MD2_HMAC>(plaintext) { }
|
48
48
|
|
49
|
-
|
49
|
+
static string getHashName() { return "MD2-HMAC"; }
|
50
50
|
};
|
51
51
|
#endif
|
52
52
|
|