cryptopp 0.0.4 → 0.0.5

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.
Files changed (195) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/Gemfile +14 -0
  4. data/Guardfile +17 -0
  5. data/MIT-LICENSE +1 -1
  6. data/Rakefile +20 -27
  7. data/VERSION +1 -0
  8. data/cryptopp.gemspec +7 -182
  9. data/ext/Rakefile +2 -2
  10. data/ext/ciphers.cpp +619 -619
  11. data/ext/cryptopp.cpp +220 -217
  12. data/ext/cryptopp_ruby_api.h +7 -7
  13. data/ext/defs/hashes.def +16 -0
  14. data/ext/defs/hmacs.def +16 -0
  15. data/ext/digests.cpp +635 -601
  16. data/ext/extconf.rb +61 -19
  17. data/ext/j3way.cpp +5 -5
  18. data/ext/j3way.h +6 -6
  19. data/ext/jadler32.h +6 -6
  20. data/ext/jaes.cpp +5 -5
  21. data/ext/jaes.h +6 -6
  22. data/ext/jarc4.cpp +5 -5
  23. data/ext/jarc4.h +6 -6
  24. data/ext/jbase.cpp +94 -94
  25. data/ext/jbase.h +49 -55
  26. data/ext/jbasiccipherinfo.h +23 -23
  27. data/ext/jblowfish.cpp +5 -5
  28. data/ext/jblowfish.h +6 -6
  29. data/ext/jcamellia.cpp +5 -7
  30. data/ext/jcamellia.h +6 -8
  31. data/ext/jcast128.cpp +5 -5
  32. data/ext/jcast128.h +6 -6
  33. data/ext/jcast256.cpp +5 -5
  34. data/ext/jcast256.h +6 -6
  35. data/ext/jcipher.cpp +62 -62
  36. data/ext/jcipher.h +24 -24
  37. data/ext/jcipher_t.h +383 -383
  38. data/ext/jconfig.h +29 -46
  39. data/ext/jconstants.h +120 -122
  40. data/ext/jcrc32.h +6 -6
  41. data/ext/jdes.cpp +5 -5
  42. data/ext/jdes.h +6 -6
  43. data/ext/jdes_ede2.cpp +5 -5
  44. data/ext/jdes_ede2.h +6 -6
  45. data/ext/jdes_ede3.cpp +5 -5
  46. data/ext/jdes_ede3.h +6 -6
  47. data/ext/jdes_xex3.cpp +5 -5
  48. data/ext/jdes_xex3.h +6 -6
  49. data/ext/jdiamond2.cpp +5 -5
  50. data/ext/jdiamond2.h +6 -6
  51. data/ext/jdiamond2lite.cpp +5 -5
  52. data/ext/jdiamond2lite.h +6 -6
  53. data/ext/jexception.h +5 -5
  54. data/ext/jgost.cpp +5 -5
  55. data/ext/jgost.h +6 -6
  56. data/ext/jhash.cpp +51 -51
  57. data/ext/jhash.h +22 -27
  58. data/ext/jhash_t.h +59 -59
  59. data/ext/jhaval.h +15 -15
  60. data/ext/jhelpers.cpp +54 -54
  61. data/ext/jhelpers.h +3 -3
  62. data/ext/jhmac.cpp +20 -20
  63. data/ext/jhmac.h +15 -15
  64. data/ext/jhmac_t.h +40 -72
  65. data/ext/jidea.cpp +5 -5
  66. data/ext/jidea.h +6 -6
  67. data/ext/jmarc4.cpp +5 -5
  68. data/ext/jmarc4.h +6 -6
  69. data/ext/jmars.cpp +5 -5
  70. data/ext/jmars.h +6 -6
  71. data/ext/jmd2.h +9 -9
  72. data/ext/jmd4.h +9 -9
  73. data/ext/jmd5.h +9 -9
  74. data/ext/jpanamacipher.cpp +7 -7
  75. data/ext/jpanamacipher.h +9 -9
  76. data/ext/jpanamahash.h +9 -9
  77. data/ext/jrc2.cpp +15 -15
  78. data/ext/jrc2.h +11 -11
  79. data/ext/jrc5.cpp +5 -5
  80. data/ext/jrc5.h +6 -6
  81. data/ext/jrc6.cpp +5 -5
  82. data/ext/jrc6.h +6 -6
  83. data/ext/jripemd160.h +28 -28
  84. data/ext/jsafer.cpp +7 -7
  85. data/ext/jsafer.h +9 -9
  86. data/ext/jseal.cpp +7 -7
  87. data/ext/jseal.h +9 -9
  88. data/ext/jserpent.cpp +5 -5
  89. data/ext/jserpent.h +6 -6
  90. data/ext/jsha.h +38 -37
  91. data/ext/jsha3.h +130 -0
  92. data/ext/jsha3_blocksizes.h +73 -0
  93. data/ext/jshacal2.cpp +5 -5
  94. data/ext/jshacal2.h +6 -6
  95. data/ext/jshark.cpp +5 -7
  96. data/ext/jshark.h +6 -8
  97. data/ext/jsink.cpp +57 -57
  98. data/ext/jsink.h +127 -123
  99. data/ext/jskipjack.cpp +5 -5
  100. data/ext/jskipjack.h +6 -6
  101. data/ext/jsquare.cpp +5 -5
  102. data/ext/jsquare.h +6 -6
  103. data/ext/jstream.cpp +3 -3
  104. data/ext/jstream.h +3 -3
  105. data/ext/jstream_t.h +74 -126
  106. data/ext/jtea.cpp +5 -5
  107. data/ext/jtea.h +6 -6
  108. data/ext/jtiger.h +9 -11
  109. data/ext/jtwofish.cpp +5 -5
  110. data/ext/jtwofish.h +6 -6
  111. data/ext/jwhirlpool.h +9 -11
  112. data/ext/utils.cpp +3 -3
  113. data/extras/parser_c.rb +102 -102
  114. data/test/ciphers_test.rb +24 -30
  115. data/test/data/ciphers/3desval.yml +13 -0
  116. data/test/data/ciphers/3wayval.yml +17 -0
  117. data/test/data/ciphers/arc4.yml +22 -0
  118. data/test/data/ciphers/blowfish.yml +9 -0
  119. data/test/data/ciphers/camellia.yml +21 -0
  120. data/test/data/ciphers/cast128v.yml +13 -0
  121. data/test/data/ciphers/cast256v.yml +13 -0
  122. data/test/data/ciphers/descert.yml +723 -0
  123. data/test/data/ciphers/diamond.yml +31 -0
  124. data/test/data/ciphers/gostval.yml +33 -0
  125. data/test/data/ciphers/ideaval.yml +45 -0
  126. data/test/data/ciphers/marsval.yml +37 -0
  127. data/test/data/ciphers/panamac.yml +11 -0
  128. data/test/data/ciphers/rc2val.yml +49 -0
  129. data/test/data/ciphers/rc5val.yml +26 -0
  130. data/test/data/ciphers/rc6val.yml +25 -0
  131. data/test/data/ciphers/rijndael.yml +37 -0
  132. data/test/data/ciphers/saferval.yml +77 -0
  133. data/test/data/ciphers/seal.yml +6 -0
  134. data/test/data/ciphers/serpentv.yml +37 -0
  135. data/test/data/ciphers/shacal2.yml +21 -0
  136. data/test/data/ciphers/sharkval.yml +29 -0
  137. data/test/data/ciphers/skipjack.yml +5 -0
  138. data/test/data/ciphers/squareva.yml +33 -0
  139. data/test/data/ciphers/twofishv.yml +37 -0
  140. data/test/data/digests/adler32.yml +19 -0
  141. data/test/data/digests/crc32.yml +25 -0
  142. data/test/data/digests/haval.yml +7 -0
  143. data/test/data/digests/havalcer.yml +1 -0
  144. data/test/data/digests/md2.yml +22 -0
  145. data/test/data/digests/md4.yml +22 -0
  146. data/test/data/digests/md5.yml +22 -0
  147. data/test/data/digests/panamah.yml +13 -0
  148. data/test/data/digests/ripemd.yml +97 -0
  149. data/test/data/digests/sha.yml +25 -0
  150. data/test/data/digests/sha3.yml +23 -0
  151. data/test/data/digests/tiger.yml +30 -0
  152. data/test/data/digests/whirlpool.yml +25 -0
  153. data/test/data/hmacs/hmac.yml +14 -0
  154. data/test/digests_test.rb +17 -23
  155. data/test/hmacs_test.rb +25 -31
  156. data/test/test_helper.rb +31 -37
  157. metadata +70 -82
  158. data/test/data/ciphers/3desval.dat +0 -7
  159. data/test/data/ciphers/3wayval.dat +0 -6
  160. data/test/data/ciphers/arc4.dat +0 -8
  161. data/test/data/ciphers/blowfish.dat +0 -5
  162. data/test/data/ciphers/camellia.dat +0 -7
  163. data/test/data/ciphers/cast128v.dat +0 -5
  164. data/test/data/ciphers/cast256v.dat +0 -5
  165. data/test/data/ciphers/descert.dat +0 -198
  166. data/test/data/ciphers/diamond.dat +0 -9
  167. data/test/data/ciphers/gostval.dat +0 -10
  168. data/test/data/ciphers/ideaval.dat +0 -13
  169. data/test/data/ciphers/marsval.dat +0 -11
  170. data/test/data/ciphers/panamac.dat +0 -7
  171. data/test/data/ciphers/rc2val.dat +0 -10
  172. data/test/data/ciphers/rc5val.dat +0 -7
  173. data/test/data/ciphers/rc6val.dat +0 -8
  174. data/test/data/ciphers/rijndael.dat +0 -11
  175. data/test/data/ciphers/saferval.dat +0 -27
  176. data/test/data/ciphers/seal.dat +0 -3
  177. data/test/data/ciphers/serpentv.dat +0 -11
  178. data/test/data/ciphers/shacal2.dat +0 -7
  179. data/test/data/ciphers/sharkval.dat +0 -9
  180. data/test/data/ciphers/skipjack.dat +0 -3
  181. data/test/data/ciphers/squareva.dat +0 -10
  182. data/test/data/ciphers/twofishv.dat +0 -11
  183. data/test/data/digests/adler32.dat +0 -8
  184. data/test/data/digests/crc32.dat +0 -10
  185. data/test/data/digests/haval.dat +0 -4
  186. data/test/data/digests/havalcer.dat +0 -23
  187. data/test/data/digests/md2.dat +0 -9
  188. data/test/data/digests/md4.dat +0 -9
  189. data/test/data/digests/md5.dat +0 -9
  190. data/test/data/digests/panamah.dat +0 -8
  191. data/test/data/digests/ripemd.dat +0 -43
  192. data/test/data/digests/sha.dat +0 -19
  193. data/test/data/digests/tiger.dat +0 -11
  194. data/test/data/digests/whirlpool.dat +0 -13
  195. data/test/data/hmacs/hmac.dat +0 -6
@@ -1,8 +1,8 @@
1
1
 
2
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
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 "jskipjack.h"
@@ -11,12 +11,12 @@
11
11
 
12
12
  BlockCipher* JSKIPJACK::getEncryptionObject()
13
13
  {
14
- return new SKIPJACKEncryption((byte*) itsKey.data(), itsKeylength);
14
+ return new SKIPJACKEncryption((byte*) itsKey.data(), itsKeylength);
15
15
  }
16
16
 
17
17
  BlockCipher* JSKIPJACK::getDecryptionObject()
18
18
  {
19
- return new SKIPJACKDecryption((byte*) itsKey.data(), itsKeylength);
19
+ return new SKIPJACKDecryption((byte*) itsKey.data(), itsKeylength);
20
20
  }
21
21
 
22
22
  #endif
@@ -1,8 +1,8 @@
1
1
 
2
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
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 __JSKIPJACK_H__
@@ -22,9 +22,9 @@ using namespace CryptoPP;
22
22
 
23
23
  class JSKIPJACK : public JCipher_Template<SKIPJACK_Info, SKIPJACK_CIPHER>
24
24
  {
25
- protected:
26
- BlockCipher* getEncryptionObject();
27
- BlockCipher* getDecryptionObject();
25
+ protected:
26
+ BlockCipher* getEncryptionObject();
27
+ BlockCipher* getDecryptionObject();
28
28
  };
29
29
 
30
30
  #endif
@@ -1,8 +1,8 @@
1
1
 
2
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
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 "jsquare.h"
@@ -11,12 +11,12 @@
11
11
 
12
12
  BlockCipher* JSquare::getEncryptionObject()
13
13
  {
14
- return new SquareEncryption((byte*) itsKey.data(), itsKeylength);
14
+ return new SquareEncryption((byte*) itsKey.data(), itsKeylength);
15
15
  }
16
16
 
17
17
  BlockCipher* JSquare::getDecryptionObject()
18
18
  {
19
- return new SquareDecryption((byte*) itsKey.data(), itsKeylength);
19
+ return new SquareDecryption((byte*) itsKey.data(), itsKeylength);
20
20
  }
21
21
 
22
22
  #endif
@@ -1,8 +1,8 @@
1
1
 
2
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
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 __JSQUARE_H__
@@ -22,9 +22,9 @@ using namespace CryptoPP;
22
22
 
23
23
  class JSquare : public JCipher_Template<Square_Info, SQUARE_CIPHER>
24
24
  {
25
- protected:
26
- BlockCipher* getEncryptionObject();
27
- BlockCipher* getDecryptionObject();
25
+ protected:
26
+ BlockCipher* getEncryptionObject();
27
+ BlockCipher* getDecryptionObject();
28
28
  };
29
29
 
30
30
  #endif
@@ -1,8 +1,8 @@
1
1
 
2
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
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 "jstream.h"
@@ -1,8 +1,8 @@
1
1
 
2
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
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 __JSTREAM_H__
@@ -1,8 +1,8 @@
1
1
 
2
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
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 __JSTREAM_T_H__
@@ -13,163 +13,111 @@
13
13
  template <typename INFO, enum CipherEnum TYPE>
14
14
  class JStream_Template : public JBasicCipherInfo<INFO, JStream>
15
15
  {
16
- public:
17
- JStream_Template();
16
+ public:
17
+ JStream_Template();
18
18
 
19
- inline enum CipherEnum getCipherType() const;
20
- inline unsigned int getBlockSize() const { return 0; }
19
+ inline enum CipherEnum getCipherType() const;
20
+ inline unsigned int getBlockSize() const { return 0; }
21
21
 
22
- bool encrypt();
23
- bool decrypt();
22
+ bool encrypt();
23
+ bool decrypt();
24
24
 
25
- bool encryptRubyIO(VALUE* in, VALUE* out);
26
- bool decryptRubyIO(VALUE* in, VALUE* out);
25
+ bool encryptRubyIO(VALUE* in, VALUE* out);
26
+ bool decryptRubyIO(VALUE* in, VALUE* out);
27
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;
28
+ protected:
29
+ virtual SymmetricCipher* getEncryptionObject() = 0;
30
+ virtual SymmetricCipher* getDecryptionObject() = 0;
37
31
  };
38
32
 
39
33
  template <typename INFO, enum CipherEnum TYPE>
40
34
  JStream_Template<INFO, TYPE>::JStream_Template()
41
35
  {
42
- this->itsKeylength = INFO::DEFAULT_KEYLENGTH;
36
+ this->itsKeylength = INFO::DEFAULT_KEYLENGTH;
43
37
  }
44
38
 
45
39
  template <typename INFO, enum CipherEnum TYPE>
46
40
  CipherEnum JStream_Template<INFO, TYPE>::getCipherType() const
47
41
  {
48
- return TYPE;
42
+ return TYPE;
49
43
  }
50
44
 
51
45
  template <typename INFO, enum CipherEnum TYPE>
52
46
  bool JStream_Template<INFO, TYPE>::encrypt()
53
47
  {
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
- }
48
+ StreamTransformation* cipher = NULL;
49
+
50
+ cipher = getEncryptionObject();
51
+
52
+ if (cipher != NULL) {
53
+ this->itsCiphertext.erase();
54
+ StringSource(this->itsPlaintext, true, new StreamTransformationFilter(*cipher, new StringSink(this->itsCiphertext)));
55
+ delete cipher;
56
+ return true;
57
+ }
58
+ else {
59
+ return false;
60
+ }
67
61
  }
68
62
 
69
63
  template <typename INFO, enum CipherEnum TYPE>
70
64
  bool JStream_Template<INFO, TYPE>::decrypt()
71
65
  {
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
- }
66
+ StreamTransformation* cipher = NULL;
67
+
68
+ cipher = getDecryptionObject();
69
+
70
+ if (cipher != NULL) {
71
+ this->itsPlaintext.erase();
72
+ StringSource(this->itsCiphertext, true, new StreamTransformationFilter(*cipher, new StringSink(this->itsPlaintext)));
73
+ delete cipher;
74
+ return true;
75
+ }
76
+ else {
77
+ return false;
78
+ }
85
79
  }
86
80
 
87
81
  template <typename INFO, enum CipherEnum TYPE>
88
82
  bool JStream_Template<INFO, TYPE>::encryptRubyIO(VALUE* in, VALUE* out)
89
83
  {
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;
84
+ StreamTransformation* cipher = NULL;
85
+
86
+ cipher = getEncryptionObject();
87
+
88
+ if (cipher != NULL) {
89
+ try {
90
+ RubyIOSource(&in, true, new StreamTransformationFilter(*cipher, new RubyIOSink(&out)));
91
+ }
92
+ catch (RubyIOStore::OpenErr e) {
93
+ delete cipher;
94
+ throw e;
95
+ }
96
+ delete cipher;
97
+ }
98
+
99
+ return true;
106
100
  }
107
101
 
108
102
  template <typename INFO, enum CipherEnum TYPE>
109
103
  bool JStream_Template<INFO, TYPE>::decryptRubyIO(VALUE* in, VALUE* out)
110
104
  {
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;
105
+ StreamTransformation* cipher = NULL;
106
+
107
+ cipher = getDecryptionObject();
108
+
109
+ if (cipher != NULL) {
110
+ try {
111
+ RubyIOSource(&in, true, new StreamTransformationFilter(*cipher, new RubyIOSink(&out)));
112
+ }
113
+ catch (RubyIOStore::OpenErr e) {
114
+ delete cipher;
115
+ throw e;
116
+ }
117
+ delete cipher;
118
+ }
119
+
120
+ return true;
172
121
  }
173
- */
174
122
 
175
123
  #endif
@@ -1,8 +1,8 @@
1
1
 
2
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
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 "jtea.h"
@@ -11,12 +11,12 @@
11
11
 
12
12
  BlockCipher* JTEA::getEncryptionObject()
13
13
  {
14
- return new TEAEncryption((byte*) itsKey.data(), itsKeylength);
14
+ return new TEAEncryption((byte*) itsKey.data(), itsKeylength);
15
15
  }
16
16
 
17
17
  BlockCipher* JTEA::getDecryptionObject()
18
18
  {
19
- return new TEADecryption((byte*) itsKey.data(), itsKeylength);
19
+ return new TEADecryption((byte*) itsKey.data(), itsKeylength);
20
20
  }
21
21
 
22
22
  #endif
data/ext/jtea.h CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
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
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 __JTEA_H__
@@ -22,9 +22,9 @@ using namespace CryptoPP;
22
22
 
23
23
  class JTEA : public JCipher_Template<TEA_Info, TEA_CIPHER>
24
24
  {
25
- protected:
26
- BlockCipher* getEncryptionObject();
27
- BlockCipher* getDecryptionObject();
25
+ protected:
26
+ BlockCipher* getEncryptionObject();
27
+ BlockCipher* getDecryptionObject();
28
28
  };
29
29
 
30
30
  #endif
@@ -1,8 +1,8 @@
1
1
 
2
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
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 __JTIGER_H__
@@ -10,7 +10,6 @@
10
10
 
11
11
  #include "jconfig.h"
12
12
 
13
- #ifdef WORD64_AVAILABLE
14
13
  #if ENABLED_TIGER_HASH || ENABLED_TIGER_HMAC
15
14
 
16
15
  #if ENABLED_TIGER_HASH
@@ -30,23 +29,22 @@ using namespace CryptoPP;
30
29
  #if ENABLED_TIGER_HASH
31
30
  class JTiger : public JHash_Template<Tiger, TIGER_HASH>
32
31
  {
33
- public:
34
- JTiger(string plaintext = "") : JHash_Template<Tiger, TIGER_HASH>(plaintext) { }
32
+ public:
33
+ JTiger(string plaintext = "") : JHash_Template<Tiger, TIGER_HASH>(plaintext) { }
35
34
 
36
- static string getHashName() { return "Tiger"; }
35
+ static string getHashName() { return "Tiger"; }
37
36
  };
38
37
  #endif
39
38
 
40
39
  #if ENABLED_TIGER_HMAC
41
40
  class JTiger_HMAC : public JHMAC_Template<Tiger, TIGER_HMAC>
42
41
  {
43
- public:
44
- JTiger_HMAC(string plaintext = "") : JHMAC_Template<Tiger, TIGER_HMAC>(plaintext) { }
42
+ public:
43
+ JTiger_HMAC(string plaintext = "") : JHMAC_Template<Tiger, TIGER_HMAC>(plaintext) { }
45
44
 
46
- static string getHashName() { return "Tiger HMAC"; }
45
+ static string getHashName() { return "Tiger HMAC"; }
47
46
  };
48
47
  #endif
49
48
 
50
49
  #endif
51
50
  #endif
52
- #endif