cryptopp 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/jidea.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 "jidea.h"
|
|
9
|
+
|
|
10
|
+
#if ENABLED_IDEA_CIPHER
|
|
11
|
+
|
|
12
|
+
BlockCipher* JIDEA::getEncryptionObject()
|
|
13
|
+
{
|
|
14
|
+
return new IDEAEncryption((byte*) itsKey.data(), itsKeylength);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
BlockCipher* JIDEA::getDecryptionObject()
|
|
18
|
+
{
|
|
19
|
+
return new IDEADecryption((byte*) itsKey.data(), itsKeylength);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#endif
|
data/ext/jidea.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 __JIDEA_H__
|
|
9
|
+
#define __JIDEA_H__
|
|
10
|
+
|
|
11
|
+
#include "jconfig.h"
|
|
12
|
+
|
|
13
|
+
#if ENABLED_IDEA_CIPHER
|
|
14
|
+
|
|
15
|
+
#include "jcipher_t.h"
|
|
16
|
+
|
|
17
|
+
// Crypto++ headers...
|
|
18
|
+
|
|
19
|
+
#include "idea.h"
|
|
20
|
+
|
|
21
|
+
using namespace CryptoPP;
|
|
22
|
+
|
|
23
|
+
class JIDEA : public JCipher_Template<IDEA_Info, IDEA_CIPHER>
|
|
24
|
+
{
|
|
25
|
+
protected:
|
|
26
|
+
BlockCipher* getEncryptionObject();
|
|
27
|
+
BlockCipher* getDecryptionObject();
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
#endif
|
|
31
|
+
#endif
|
data/ext/jmarc4.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 "jmarc4.h"
|
|
9
|
+
|
|
10
|
+
#if ENABLED_MARC4_CIPHER
|
|
11
|
+
|
|
12
|
+
SymmetricCipher* JMARC4::getEncryptionObject()
|
|
13
|
+
{
|
|
14
|
+
return new Weak::MARC4((byte*) itsKey.data(), itsKeylength);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
SymmetricCipher* JMARC4::getDecryptionObject()
|
|
18
|
+
{
|
|
19
|
+
return getEncryptionObject();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#endif
|
data/ext/jmarc4.h
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
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 __JMARC4_H__
|
|
9
|
+
#define __JMARC4_H__
|
|
10
|
+
|
|
11
|
+
#include "jconfig.h"
|
|
12
|
+
|
|
13
|
+
#if ENABLED_MARC4_CIPHER
|
|
14
|
+
|
|
15
|
+
#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK
|
|
16
|
+
#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
#include "jstream_t.h"
|
|
20
|
+
|
|
21
|
+
// Crypto++ headers...
|
|
22
|
+
|
|
23
|
+
#include "arc4.h"
|
|
24
|
+
|
|
25
|
+
using namespace CryptoPP;
|
|
26
|
+
|
|
27
|
+
class JMARC4 : public JStream_Template<Weak::MARC4_Base, MARC4_CIPHER>
|
|
28
|
+
{
|
|
29
|
+
protected:
|
|
30
|
+
SymmetricCipher* getEncryptionObject();
|
|
31
|
+
SymmetricCipher* getDecryptionObject();
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
#undef CRYPTOPP_ENABLE_NAMESPACE_WEAK
|
|
35
|
+
|
|
36
|
+
#endif
|
|
37
|
+
#endif
|
data/ext/jmars.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 "jmars.h"
|
|
9
|
+
|
|
10
|
+
#if ENABLED_MARS_CIPHER
|
|
11
|
+
|
|
12
|
+
BlockCipher* JMARS::getEncryptionObject()
|
|
13
|
+
{
|
|
14
|
+
return new MARSEncryption((byte*) itsKey.data(), itsKeylength);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
BlockCipher* JMARS::getDecryptionObject()
|
|
18
|
+
{
|
|
19
|
+
return new MARSDecryption((byte*) itsKey.data(), itsKeylength);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#endif
|
data/ext/jmars.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 __JMARS_H__
|
|
9
|
+
#define __JMARS_H__
|
|
10
|
+
|
|
11
|
+
#include "jconfig.h"
|
|
12
|
+
|
|
13
|
+
#if ENABLED_MARS_CIPHER
|
|
14
|
+
|
|
15
|
+
#include "jcipher_t.h"
|
|
16
|
+
|
|
17
|
+
// Crypto++ headers...
|
|
18
|
+
|
|
19
|
+
#include "mars.h"
|
|
20
|
+
|
|
21
|
+
using namespace CryptoPP;
|
|
22
|
+
|
|
23
|
+
class JMARS : public JCipher_Template<MARS_Info, MARS_CIPHER>
|
|
24
|
+
{
|
|
25
|
+
protected:
|
|
26
|
+
BlockCipher* getEncryptionObject();
|
|
27
|
+
BlockCipher* getDecryptionObject();
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
#endif
|
|
31
|
+
#endif
|
data/ext/jmd2.h
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
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 __JMD2_H__
|
|
9
|
+
#define __JMD2_H__
|
|
10
|
+
|
|
11
|
+
#include "jconfig.h"
|
|
12
|
+
|
|
13
|
+
#if ENABLED_MD2_HASH || ENABLED_MD2_HMAC
|
|
14
|
+
|
|
15
|
+
#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK
|
|
16
|
+
#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
#if ENABLED_MD2_HASH
|
|
20
|
+
#include "jhash_t.h"
|
|
21
|
+
#endif
|
|
22
|
+
|
|
23
|
+
#if ENABLED_MD2_HMAC
|
|
24
|
+
#include "jhmac_t.h"
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
// Crypto++ headers...
|
|
28
|
+
|
|
29
|
+
#include "md2.h"
|
|
30
|
+
|
|
31
|
+
using namespace CryptoPP;
|
|
32
|
+
|
|
33
|
+
#if ENABLED_MD2_HASH
|
|
34
|
+
class JMD2 : public JHash_Template<Weak::MD2, MD2_HASH>
|
|
35
|
+
{
|
|
36
|
+
public:
|
|
37
|
+
JMD2(string plaintext = "") : JHash_Template<Weak::MD2, MD2_HASH>(plaintext) { }
|
|
38
|
+
|
|
39
|
+
static string getHashName() { return "MD2"; }
|
|
40
|
+
};
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
#if ENABLED_MD5_HMAC
|
|
44
|
+
class JMD2_HMAC : public JHMAC_Template<Weak::MD2, MD2_HMAC>
|
|
45
|
+
{
|
|
46
|
+
public:
|
|
47
|
+
JMD2_HMAC(string plaintext = "") : JHMAC_Template<Weak::MD2, MD2_HMAC>(plaintext) { }
|
|
48
|
+
|
|
49
|
+
static string getHashName() { return "MD2-HMAC"; }
|
|
50
|
+
};
|
|
51
|
+
#endif
|
|
52
|
+
|
|
53
|
+
#undef CRYPTOPP_ENABLE_NAMESPACE_WEAK
|
|
54
|
+
|
|
55
|
+
#endif
|
|
56
|
+
#endif
|
data/ext/jmd4.h
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
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 __JMD4_H__
|
|
9
|
+
#define __JMD4_H__
|
|
10
|
+
|
|
11
|
+
#include "jconfig.h"
|
|
12
|
+
|
|
13
|
+
#if ENABLED_MD4_HASH || ENABLED_MD4_HMAC
|
|
14
|
+
|
|
15
|
+
#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK
|
|
16
|
+
#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
#if ENABLED_MD4_HASH
|
|
20
|
+
#include "jhash_t.h"
|
|
21
|
+
#endif
|
|
22
|
+
|
|
23
|
+
#if ENABLED_MD4_HMAC
|
|
24
|
+
#include "jhmac_t.h"
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
// Crypto++ headers...
|
|
28
|
+
|
|
29
|
+
#include "md4.h"
|
|
30
|
+
|
|
31
|
+
using namespace CryptoPP;
|
|
32
|
+
|
|
33
|
+
#if ENABLED_MD4_HASH
|
|
34
|
+
class JMD4 : public JHash_Template<Weak::MD4, MD4_HASH>
|
|
35
|
+
{
|
|
36
|
+
public:
|
|
37
|
+
JMD4(string plaintext = "") : JHash_Template<Weak::MD4, MD4_HASH>(plaintext) { }
|
|
38
|
+
|
|
39
|
+
static string getHashName() { return "MD4"; }
|
|
40
|
+
};
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
#if ENABLED_MD4_HMAC
|
|
44
|
+
class JMD4_HMAC : public JHMAC_Template<Weak::MD4, MD4_HMAC>
|
|
45
|
+
{
|
|
46
|
+
public:
|
|
47
|
+
JMD4_HMAC(string plaintext = "") : JHMAC_Template<Weak::MD4, MD4_HMAC>(plaintext) { }
|
|
48
|
+
|
|
49
|
+
static string getHashName() { return "MD4-HMAC"; }
|
|
50
|
+
};
|
|
51
|
+
#endif
|
|
52
|
+
|
|
53
|
+
#undef CRYPTOPP_ENABLE_NAMESPACE_WEAK
|
|
54
|
+
|
|
55
|
+
#endif
|
|
56
|
+
#endif
|
data/ext/jmd5.h
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
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 __JMD5_H__
|
|
9
|
+
#define __JMD5_H__
|
|
10
|
+
|
|
11
|
+
#include "jconfig.h"
|
|
12
|
+
|
|
13
|
+
#if ENABLED_MD5_HASH || ENABLED_MD5_HMAC
|
|
14
|
+
|
|
15
|
+
#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK
|
|
16
|
+
#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
#if ENABLED_MD5_HASH
|
|
20
|
+
#include "jhash_t.h"
|
|
21
|
+
#endif
|
|
22
|
+
|
|
23
|
+
#if ENABLED_MD5_HMAC
|
|
24
|
+
#include "jhmac_t.h"
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
// Crypto++ headers...
|
|
28
|
+
|
|
29
|
+
#include "md5.h"
|
|
30
|
+
|
|
31
|
+
using namespace CryptoPP;
|
|
32
|
+
|
|
33
|
+
#if ENABLED_MD5_HASH
|
|
34
|
+
class JMD5 : public JHash_Template<Weak::MD5, MD5_HASH>
|
|
35
|
+
{
|
|
36
|
+
public:
|
|
37
|
+
JMD5(string plaintext = "") : JHash_Template<Weak::MD5, MD5_HASH>(plaintext) { }
|
|
38
|
+
|
|
39
|
+
static string getHashName() { return "MD5"; }
|
|
40
|
+
};
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
#if ENABLED_MD5_HMAC
|
|
44
|
+
class JMD5_HMAC : public JHMAC_Template<Weak::MD5, MD5_HMAC>
|
|
45
|
+
{
|
|
46
|
+
public:
|
|
47
|
+
JMD5_HMAC(string plaintext = "") : JHMAC_Template<Weak::MD5, MD5_HMAC>(plaintext) { }
|
|
48
|
+
|
|
49
|
+
static string getHashName() { return "MD5-HMAC"; }
|
|
50
|
+
};
|
|
51
|
+
#endif
|
|
52
|
+
|
|
53
|
+
#undef CRYPTOPP_ENABLE_NAMESPACE_WEAK
|
|
54
|
+
|
|
55
|
+
#endif
|
|
56
|
+
#endif
|
|
@@ -0,0 +1,32 @@
|
|
|
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 "jpanamacipher.h"
|
|
9
|
+
|
|
10
|
+
#if ENABLED_PANAMA_LITTLE_ENDIAN_CIPHER
|
|
11
|
+
SymmetricCipher* JPanamaCipherLE::getEncryptionObject()
|
|
12
|
+
{
|
|
13
|
+
return new PanamaCipher<LittleEndian>::Encryption((byte*) itsKey.data(), itsKeylength, (byte*) itsIV.data());
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
SymmetricCipher* JPanamaCipherLE::getDecryptionObject()
|
|
17
|
+
{
|
|
18
|
+
return new PanamaCipher<LittleEndian>::Decryption((byte*) itsKey.data(), itsKeylength, (byte*) itsIV.data());
|
|
19
|
+
}
|
|
20
|
+
#endif
|
|
21
|
+
|
|
22
|
+
#if ENABLED_PANAMA_BIG_ENDIAN_CIPHER
|
|
23
|
+
SymmetricCipher* JPanamaCipherBE::getEncryptionObject()
|
|
24
|
+
{
|
|
25
|
+
return new PanamaCipher<BigEndian>::Encryption((byte*) itsKey.data(), itsKeylength, (byte*) itsIV.data());
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
SymmetricCipher* JPanamaCipherBE::getDecryptionObject()
|
|
29
|
+
{
|
|
30
|
+
return new PanamaCipher<BigEndian>::Decryption((byte*) itsKey.data(), itsKeylength, (byte*) itsIV.data());
|
|
31
|
+
}
|
|
32
|
+
#endif
|
data/ext/jpanamacipher.h
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
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 __JPANAMACIPHER_H__
|
|
9
|
+
#define __JPANAMACIPHER_H__
|
|
10
|
+
|
|
11
|
+
#include "jconfig.h"
|
|
12
|
+
|
|
13
|
+
#if ENABLED_PANAMA_LITTLE_ENDIAN_CIPHER || ENABLED_PANAMA_BIG_ENDIAN_CIPHER
|
|
14
|
+
|
|
15
|
+
#include "jstream_t.h"
|
|
16
|
+
|
|
17
|
+
// Crypto++ headers...
|
|
18
|
+
|
|
19
|
+
#include "panama.h"
|
|
20
|
+
|
|
21
|
+
using namespace CryptoPP;
|
|
22
|
+
|
|
23
|
+
#if ENABLED_PANAMA_LITTLE_ENDIAN_CIPHER
|
|
24
|
+
class JPanamaCipherLE : public JStream_Template<PanamaCipherInfo<LittleEndian>, PANAMA_LITTLE_ENDIAN_CIPHER>
|
|
25
|
+
{
|
|
26
|
+
protected:
|
|
27
|
+
SymmetricCipher* getEncryptionObject();
|
|
28
|
+
SymmetricCipher* getDecryptionObject();
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
typedef JPanamaCipherLE JPanamaLittleEndianCipher;
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
#if ENABLED_PANAMA_BIG_ENDIAN_CIPHER
|
|
35
|
+
class JPanamaCipherBE : public JStream_Template<PanamaCipherInfo<BigEndian>, PANAMA_BIG_ENDIAN_CIPHER>
|
|
36
|
+
{
|
|
37
|
+
protected:
|
|
38
|
+
SymmetricCipher* getEncryptionObject();
|
|
39
|
+
SymmetricCipher* getDecryptionObject();
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
typedef JPanamaCipherBE JPanamaBigEndianCipher;
|
|
43
|
+
#endif
|
|
44
|
+
|
|
45
|
+
#endif
|
|
46
|
+
#endif
|
data/ext/jpanamahash.h
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
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 __JPANAMAHASH_H__
|
|
9
|
+
#define __JPANAMAHASH_H__
|
|
10
|
+
|
|
11
|
+
#include "jconfig.h"
|
|
12
|
+
|
|
13
|
+
#if ENABLED_PANAMA_LITTLE_ENDIAN_HASH || ENABLED_PANAMA_BIG_ENDIAN_HASH
|
|
14
|
+
|
|
15
|
+
#include "jhash_t.h"
|
|
16
|
+
|
|
17
|
+
// Crypto++ headers...
|
|
18
|
+
|
|
19
|
+
#include "panama.h"
|
|
20
|
+
|
|
21
|
+
using namespace CryptoPP;
|
|
22
|
+
|
|
23
|
+
#if ENABLED_PANAMA_LITTLE_ENDIAN_HASH
|
|
24
|
+
class JPanamaHashLE : public JHash_Template<Weak::PanamaHash<LittleEndian>, PANAMA_LITTLE_ENDIAN_HASH>
|
|
25
|
+
{
|
|
26
|
+
public:
|
|
27
|
+
JPanamaHashLE(string plaintext = "") : JHash_Template<Weak::PanamaHash<LittleEndian>, PANAMA_LITTLE_ENDIAN_HASH>(plaintext) { }
|
|
28
|
+
|
|
29
|
+
static string getHashName() { return "Panama-LE Hash"; }
|
|
30
|
+
};
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
#if ENABLED_PANAMA_BIG_ENDIAN_HASH
|
|
34
|
+
class JPanamaHashBE : public JHash_Template<Weak::PanamaHash<BigEndian>, PANAMA_BIG_ENDIAN_HASH>
|
|
35
|
+
{
|
|
36
|
+
public:
|
|
37
|
+
JPanamaHashBE(string plaintext = "") : JHash_Template<Weak::PanamaHash<BigEndian>, PANAMA_BIG_ENDIAN_HASH>(plaintext) { }
|
|
38
|
+
|
|
39
|
+
static string getHashName() { return "Panama-BE Hash"; }
|
|
40
|
+
};
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
#endif
|
|
44
|
+
#endif
|