ttcrypt 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +27 -0
- data/.rspec +2 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +44 -0
- data/README.md +45 -0
- data/Rakefile +10 -0
- data/ext/ttcrypt/.gitignore +1 -0
- data/ext/ttcrypt/big_integer.cpp +59 -0
- data/ext/ttcrypt/big_integer.h +321 -0
- data/ext/ttcrypt/byte_buffer.cpp +84 -0
- data/ext/ttcrypt/byte_buffer.h +352 -0
- data/ext/ttcrypt/common_utils.cpp +24 -0
- data/ext/ttcrypt/common_utils.h +61 -0
- data/ext/ttcrypt/extconf.rb +62 -0
- data/ext/ttcrypt/pollard_rho.cpp +83 -0
- data/ext/ttcrypt/pollard_rho.h +55 -0
- data/ext/ttcrypt/rsa_key.cpp +373 -0
- data/ext/ttcrypt/rsa_key.h +248 -0
- data/ext/ttcrypt/ruby_cpp_tools.cpp +66 -0
- data/ext/ttcrypt/ruby_cpp_tools.h +77 -0
- data/ext/ttcrypt/sha1.cpp +185 -0
- data/ext/ttcrypt/sha1.h +49 -0
- data/ext/ttcrypt/sha256.c +379 -0
- data/ext/ttcrypt/sha256.h +67 -0
- data/ext/ttcrypt/text_utils.cpp +63 -0
- data/ext/ttcrypt/text_utils.h +64 -0
- data/ext/ttcrypt/ttcrypt.cpp +51 -0
- data/ext/ttcrypt/ttcrypt.h +45 -0
- data/ext/ttcrypt/ttcrypt_ruby.cpp +234 -0
- data/lib/ttcrypt/version.rb +5 -0
- data/lib/ttcrypt.rb +142 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/ttcrypt_spec.rb +318 -0
- data/ttcrypt.gemspec +47 -0
- metadata +139 -0
@@ -0,0 +1,318 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ttcrypt'
|
3
|
+
require 'securerandom'
|
4
|
+
require 'base64'
|
5
|
+
require 'openssl'
|
6
|
+
|
7
|
+
describe 'rsa-oaep' do
|
8
|
+
|
9
|
+
# include TTCrypt
|
10
|
+
|
11
|
+
it 'should do factorization' do
|
12
|
+
# p test1("hello guys")
|
13
|
+
p1 = 0x10001
|
14
|
+
p2 = 101
|
15
|
+
factors = TTCrypt.factorize(p1*p2).sort
|
16
|
+
factors[0].should == p2
|
17
|
+
factors[1].should == p1
|
18
|
+
|
19
|
+
val = 177130
|
20
|
+
factors = TTCrypt.factorize(val)
|
21
|
+
factors.reduce(1){|all, x| x*all}.should == val
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should generate keys in background' do
|
25
|
+
stopme = false
|
26
|
+
counter = 0
|
27
|
+
Thread.start {
|
28
|
+
while !stopme
|
29
|
+
counter += 1
|
30
|
+
sleep(0.001)
|
31
|
+
end
|
32
|
+
}
|
33
|
+
rsa = TTCrypt::RsaKey.generate 1024
|
34
|
+
stopme = true
|
35
|
+
counter.should > 0
|
36
|
+
rsa.bits.should == 1024
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should not encrypt without key' do
|
40
|
+
key = TTCrypt::RsaKey.new
|
41
|
+
-> { key.decrypt('bad idea') }.should raise_error(TTCrypt::RsaKey::Error)
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
context 'having key' do
|
46
|
+
before :all do
|
47
|
+
@key = TTCrypt::RsaKey.generate 1024
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should round trip generated keys' do
|
51
|
+
msg = 'hello, world'
|
52
|
+
(decrypted=@key.decrypt((encrypted=@key.encrypt(msg)))).should == msg
|
53
|
+
encrypted.encoding.should == Encoding::BINARY
|
54
|
+
decrypted.encoding.should == Encoding::BINARY
|
55
|
+
|
56
|
+
-> { @key.encrypt 'way too long message to encrypt it!!!!!!!'*12 }
|
57
|
+
.should raise_error(TTCrypt::RsaKey::Error)
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'should round trip signatures' do
|
62
|
+
message = 'che bella cosa'
|
63
|
+
%i|sha1 sha256|.each { |hash_name|
|
64
|
+
signature = @key.sign(message, hash_name)
|
65
|
+
signature.length.should == 128
|
66
|
+
signature.encoding.should == Encoding::BINARY
|
67
|
+
@key.verify(message, signature, hash_name).should be_true
|
68
|
+
@key.verify(message+'...', signature, hash_name).should be_false
|
69
|
+
bad_signature = signature.clone
|
70
|
+
bad_signature.setbyte(0, bad_signature.getbyte(0) ^ 11)
|
71
|
+
@key.verify(message, bad_signature, hash_name).should be_false
|
72
|
+
@key.verify(message, signature, hash_name).should be_true
|
73
|
+
}
|
74
|
+
-> { @key.sign(message, :wrong_hash) }.should raise_error
|
75
|
+
-> { @key.verify(message, 'no matter', :wrong_hash) }.should raise_error
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'should extract public key' do
|
79
|
+
message = 'check key pair'
|
80
|
+
pubkey = @key.extract_public
|
81
|
+
pubkey.should_not be_private
|
82
|
+
@key.should be_private
|
83
|
+
@key.decrypt(pubkey.encrypt(message)).should == message
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'should provide components' do
|
87
|
+
%i|p q e n|.each { |name|
|
88
|
+
(val=@key.send(name)).should_not be_nil
|
89
|
+
val.encoding.should == Encoding::BINARY
|
90
|
+
}
|
91
|
+
pubkey = @key.extract_public
|
92
|
+
pubkey.p.should be_nil
|
93
|
+
pubkey.q.should be_nil
|
94
|
+
pubkey.e.should == @key.e
|
95
|
+
pubkey.n.should == @key.n
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'should construct from components' do
|
100
|
+
init_test_vectors1
|
101
|
+
key = TTCrypt::RsaKey.new e: @e, p: @p, q: @q
|
102
|
+
key.p.should == @p
|
103
|
+
key.q.should == @q
|
104
|
+
key.e.should == @e
|
105
|
+
key.should be_private
|
106
|
+
key.n.should_not be_nil
|
107
|
+
key.decrypt(@encrypted_m).should == @message
|
108
|
+
key.decrypt(key.extract_public.encrypt(@message)).should == @message
|
109
|
+
end
|
110
|
+
|
111
|
+
def init_test_vectors1
|
112
|
+
@n = h2s <<-End
|
113
|
+
bb f8 2f 09 06 82 ce 9c 23 38 ac 2b 9d a8 71 f7 36 8d 07 ee d4 10 43 a4
|
114
|
+
40 d6 b6 f0 74 54 f5 1f b8 df ba af 03 5c 02 ab 61 ea 48 ce eb 6f cd 48
|
115
|
+
76 ed 52 0d 60 e1 ec 46 19 71 9d 8a 5b 8b 80 7f af b8 e0 a3 df c7 37 72
|
116
|
+
3e e6 b4 b7 d9 3a 25 84 ee 6a 64 9d 06 09 53 74 88 34 b2 45 45 98 39 4e
|
117
|
+
e0 aa b1 2d 7b 61 a5 1f 52 7a 9a 41 f6 c1 68 7f e2 53 72 98 ca 2a 8f 59
|
118
|
+
46 f8 e5 fd 09 1d bd cb
|
119
|
+
End
|
120
|
+
|
121
|
+
@e = "\x11"
|
122
|
+
|
123
|
+
@p = h2s <<-End
|
124
|
+
ee cf ae 81 b1 b9 b3 c9 08 81 0b 10 a1 b5 60 01 99 eb 9f 44 ae f4 fd a4
|
125
|
+
93 b8 1a 9e 3d 84 f6 32 12 4e f0 23 6e 5d 1e 3b 7e 28 fa e7 aa 04 0a 2d
|
126
|
+
5b 25 21 76 45 9d 1f 39 75 41 ba 2a 58 fb 65 99
|
127
|
+
End
|
128
|
+
|
129
|
+
@q = h2s <<-End
|
130
|
+
c9 7f b1 f0 27 f4 53 f6 34 12 33 ea aa d1 d9 35 3f 6c 42 d0 88 66 b1 d0
|
131
|
+
5a 0f 20 35 02 8b 9d 86 98 40 b4 16 66 b4 2e 92 ea 0d a3 b4 32 04 b5 cf
|
132
|
+
ce 33 52 52 4d 04 16 a5 a4 41 e7 00 af 46 15 03
|
133
|
+
End
|
134
|
+
|
135
|
+
@message = h2s 'd4 36 e9 95 69 fd 32 a7 c8 a0 5b bc 90 d3 2c 49'
|
136
|
+
|
137
|
+
@encrypted_m = h2s <<-End
|
138
|
+
12 53 e0 4d c0 a5 39 7b b4 4a 7a b8 7e 9b f2 a0 39 a3 3d 1e 99 6f c8 2a 94
|
139
|
+
cc d3 00 74 c9 5d f7 63 72 20 17 06 9e 52 68 da 5d 1c 0b 4f 87 2c f6 53 c1
|
140
|
+
1d f8 23 14 a6 79 68 df ea e2 8d ef 04 bb 6d 84 b1 c3 1d 65 4a 19 70 e5 78
|
141
|
+
3b d6 eb 96 a0 24 c2 ca 2f 4a 90 fe 9f 2e f5 c9 c1 40 e5 bb 48 da 95 36 ad
|
142
|
+
87 00 c8 4f c9 13 0a de a7 4e 55 8d 51 a7 4d df 85 d8 b5 0d e9 68 38 d6 06
|
143
|
+
3e 09 55
|
144
|
+
End
|
145
|
+
end
|
146
|
+
|
147
|
+
def h2s hex
|
148
|
+
hex = hex.gsub(/\s+/, '')
|
149
|
+
hex.chars.each_slice(2).map{|x,y| (x.to_i(16)<<4 | y.to_i(16)).chr}.join
|
150
|
+
end
|
151
|
+
|
152
|
+
|
153
|
+
# include Ttcrypt::NumUtils
|
154
|
+
#
|
155
|
+
# before :all do
|
156
|
+
# # test vectors
|
157
|
+
# init_test_vectors
|
158
|
+
# end
|
159
|
+
#
|
160
|
+
# it 'should convert long to bytes and back' do
|
161
|
+
# 30.times {
|
162
|
+
# n = SecureRandom.random_number (17+SecureRandom.random_number(157))
|
163
|
+
# k = SecureRandom.random_number(5) + 2
|
164
|
+
# bytes = long_to_bytes n, k
|
165
|
+
# (bytes.length % k).should == 0
|
166
|
+
# bytes_to_long(bytes).should == n
|
167
|
+
# }
|
168
|
+
#
|
169
|
+
# src = "\x00\v\x9DtX\xA2\xAB\xAF%\xD4\xE9Xz\x9F\x9C\xC4\b\r\xDE\x14\xD8\x17\x01\xE1\x04\x04\x92\x16\xCD\x1D\x17+\xB1\xA0&6\xF9'\x8FsK\x95\xCC\x161\xAD3\xBB\x8F\xBE\x11\xBDP\xE4Z\x8E\x8Cz\xD7\x95\xC8\xA5(\x8E"
|
170
|
+
# long_to_bytes(bytes_to_long(src), src.length).should == src
|
171
|
+
#
|
172
|
+
# long_to_bytes(0, 5).should == "\x00\x00\x00\x00\x00".force_encoding(Encoding::BINARY)
|
173
|
+
# long_to_bytes(1, 2).should == "\x00\x01".force_encoding(Encoding::BINARY)
|
174
|
+
# end
|
175
|
+
#
|
176
|
+
# it 'it should run gmp' do
|
177
|
+
# a = GMP.Z((_a=11098707803864973769487639874))
|
178
|
+
# b = GMP.Z((_b=23456))
|
179
|
+
# c = GMP.Z((_c=803947509837450987038475))
|
180
|
+
# r = a.powmod(b, c)
|
181
|
+
# r1 = (_a ** _b) % _c
|
182
|
+
# r.should == r1
|
183
|
+
# end
|
184
|
+
#
|
185
|
+
# it 'should properly pad' do
|
186
|
+
# k = (bitlength(@n)+7)/8
|
187
|
+
# Ttcrypt::RsaKey.set_debug_oaep_seed @seed
|
188
|
+
# p k
|
189
|
+
# res = Ttcrypt::RsaKey.eme_oaep_encode(long_to_bytes(@message), k-1)
|
190
|
+
# bytes_to_long(res).should == @em
|
191
|
+
# end
|
192
|
+
#
|
193
|
+
# it 'should properly depad' do
|
194
|
+
# src = Ttcrypt::RsaKey.eme_oaep_decode long_to_bytes(@em)
|
195
|
+
# bytes_to_long(src).should == @message
|
196
|
+
# end
|
197
|
+
#
|
198
|
+
# it 'should properly public encrypt' do
|
199
|
+
# em = test_key.public_encrypt long_to_bytes(@message)
|
200
|
+
# bytes_to_long(em).should == @encrypted_m
|
201
|
+
# end
|
202
|
+
#
|
203
|
+
# it 'should properly private decrypt' do
|
204
|
+
# m = test_key(restrict: true).private_decrypt long_to_bytes(@encrypted_m)
|
205
|
+
# bytes_to_long(m).should == @message
|
206
|
+
# m = test_key.private_decrypt long_to_bytes(@encrypted_m)
|
207
|
+
# bytes_to_long(m).should == @message
|
208
|
+
#
|
209
|
+
# # a = 123101010122
|
210
|
+
# # b = 778901
|
211
|
+
# # puts "Inverse #{a}, #{b}-> #{inverse(a,b)}"
|
212
|
+
#
|
213
|
+
# puts "Sha1 empty "+Digest::SHA1.digest('').to_hex
|
214
|
+
# puts "Sha1 sergeych forever "+Digest::SHA1.digest('sergeych forever').to_hex
|
215
|
+
# end
|
216
|
+
#
|
217
|
+
# it 'should properly private encrypt and public decrypt'
|
218
|
+
#
|
219
|
+
# it 'should generate keys'
|
220
|
+
#
|
221
|
+
# it 'should construct crypstie keys'
|
222
|
+
# it 'should serialize crypstie keys'
|
223
|
+
#
|
224
|
+
# def h2s hex_string
|
225
|
+
# hex_string.gsub(/\s+/, '').to_i(16)
|
226
|
+
# end
|
227
|
+
#
|
228
|
+
# def test_key restrict: false
|
229
|
+
# Ttcrypt::RsaKey.set_debug_oaep_seed @seed
|
230
|
+
# if restrict
|
231
|
+
# Ttcrypt::RsaKey.new n: @n, e: @e, d: inverse(@e, lcm(@p - 1, @q - 1))
|
232
|
+
# else
|
233
|
+
# Ttcrypt::RsaKey.new n: @n, e: @e, p: @p, q: @q
|
234
|
+
# end
|
235
|
+
# end
|
236
|
+
#
|
237
|
+
# def init_test_vectors
|
238
|
+
# @n = h2s <<-End
|
239
|
+
# bb f8 2f 09 06 82 ce 9c 23 38 ac 2b 9d a8 71 f7 36 8d 07 ee d4 10 43 a4
|
240
|
+
# 40 d6 b6 f0 74 54 f5 1f b8 df ba af 03 5c 02 ab 61 ea 48 ce eb 6f cd 48
|
241
|
+
# 76 ed 52 0d 60 e1 ec 46 19 71 9d 8a 5b 8b 80 7f af b8 e0 a3 df c7 37 72
|
242
|
+
# 3e e6 b4 b7 d9 3a 25 84 ee 6a 64 9d 06 09 53 74 88 34 b2 45 45 98 39 4e
|
243
|
+
# e0 aa b1 2d 7b 61 a5 1f 52 7a 9a 41 f6 c1 68 7f e2 53 72 98 ca 2a 8f 59
|
244
|
+
# 46 f8 e5 fd 09 1d bd cb
|
245
|
+
# End
|
246
|
+
#
|
247
|
+
# @e = 0x11
|
248
|
+
#
|
249
|
+
# @p = h2s <<-End
|
250
|
+
# ee cf ae 81 b1 b9 b3 c9 08 81 0b 10 a1 b5 60 01 99 eb 9f 44 ae f4 fd a4
|
251
|
+
# 93 b8 1a 9e 3d 84 f6 32 12 4e f0 23 6e 5d 1e 3b 7e 28 fa e7 aa 04 0a 2d
|
252
|
+
# 5b 25 21 76 45 9d 1f 39 75 41 ba 2a 58 fb 65 99
|
253
|
+
# End
|
254
|
+
#
|
255
|
+
# @q = h2s <<-End
|
256
|
+
# c9 7f b1 f0 27 f4 53 f6 34 12 33 ea aa d1 d9 35 3f 6c 42 d0 88 66 b1 d0
|
257
|
+
# 5a 0f 20 35 02 8b 9d 86 98 40 b4 16 66 b4 2e 92 ea 0d a3 b4 32 04 b5 cf
|
258
|
+
# ce 33 52 52 4d 04 16 a5 a4 41 e7 00 af 46 15 03
|
259
|
+
# End
|
260
|
+
#
|
261
|
+
# @dP = h2s <<-End
|
262
|
+
# 54 49 4c a6 3e ba 03 37 e4 e2 40 23 fc d6 9a 5a eb 07 dd dc 01 83 a4 d0
|
263
|
+
# ac 9b 54 b0 51 f2 b1 3e d9 49 09 75 ea b7 74 14 ff 59 c1 f7 69 2e 9a 2e
|
264
|
+
# 20 2b 38 fc 91 0a 47 41 74 ad c9 3c 1f 67 c9 81
|
265
|
+
# End
|
266
|
+
#
|
267
|
+
# @dQ = h2s <<-End
|
268
|
+
# 47 1e 02 90 ff 0a f0 75 03 51 b7 f8 78 86 4c a9 61 ad bd 3a 8a 7e 99 1c
|
269
|
+
# 5c 05 56 a9 4c 31 46 a7 f9 80 3f 8f 6f 8a e3 42 e9 31 fd 8a e4 7a 22 0d
|
270
|
+
# 1b 99 a4 95 84 98 07 fe 39 f9 24 5a 98 36 da 3d
|
271
|
+
# End
|
272
|
+
#
|
273
|
+
# @qInv = h2s <<-End
|
274
|
+
# b0 6c 4f da bb 63 01 19 8d 26 5b db ae 94 23 b3 80 f2 71 f7 34 53 88 50
|
275
|
+
# 93 07 7f cd 39 e2 11 9f c9 86 32 15 4f 58 83 b1 67 a9 67 bf 40 2b 4e 9e
|
276
|
+
# 2e 0f 96 56 e6 98 ea 36 66 ed fb 25 79 80 39 f7
|
277
|
+
# End
|
278
|
+
#
|
279
|
+
# @message = h2s 'd4 36 e9 95 69 fd 32 a7 c8 a0 5b bc 90 d3 2c 49'
|
280
|
+
#
|
281
|
+
# @pHash = h2s 'da 39 a3 ee 5e 6b 4b 0d 32 55 bf ef 95 60 18 90 af d8 07 09'
|
282
|
+
#
|
283
|
+
# @seed = h2s 'aa fd 12 f6 59 ca e6 34 89 b4 79 e5 07 6d de c2 f0 6c b5 8f'
|
284
|
+
#
|
285
|
+
# @em = h2s <<-End
|
286
|
+
# eb 7a 19 ac e9 e3 00 63 50 e3 29 50 4b 45 e2 ca 82 31 0b 26 dc d8 7d 5c 68
|
287
|
+
# f1 ee a8 f5 52 67 c3 1b 2e 8b b4 25 1f 84 d7 e0 b2 c0 46 26 f5 af f9 3e dc
|
288
|
+
# fb 25 c9 c2 b3 ff 8a e1 0e 83 9a 2d db 4c dc fe 4f f4 77 28 b4 a1 b7 c1 36
|
289
|
+
# 2b aa d2 9a b4 8d 28 69 d5 02 41 21 43 58 11 59 1b e3 92 f9 82 fb 3e 87 d0
|
290
|
+
# 95 ae b4 04 48 db 97 2f 3a c1 4f 7b c2 75 19 52 81 ce 32 d2 f1 b7 6d 4d 35
|
291
|
+
# 3e 2d
|
292
|
+
# End
|
293
|
+
#
|
294
|
+
# @encrypted_m = h2s <<-End
|
295
|
+
# 12 53 e0 4d c0 a5 39 7b b4 4a 7a b8 7e 9b f2 a0 39 a3 3d 1e 99 6f c8 2a 94
|
296
|
+
# cc d3 00 74 c9 5d f7 63 72 20 17 06 9e 52 68 da 5d 1c 0b 4f 87 2c f6 53 c1
|
297
|
+
# 1d f8 23 14 a6 79 68 df ea e2 8d ef 04 bb 6d 84 b1 c3 1d 65 4a 19 70 e5 78
|
298
|
+
# 3b d6 eb 96 a0 24 c2 ca 2f 4a 90 fe 9f 2e f5 c9 c1 40 e5 bb 48 da 95 36 ad
|
299
|
+
# 87 00 c8 4f c9 13 0a de a7 4e 55 8d 51 a7 4d df 85 d8 b5 0d e9 68 38 d6 06
|
300
|
+
# 3e 09 55
|
301
|
+
# End
|
302
|
+
# end
|
303
|
+
#
|
304
|
+
end
|
305
|
+
#
|
306
|
+
# class String
|
307
|
+
# def to_hex
|
308
|
+
# n = 0
|
309
|
+
# res = ''
|
310
|
+
# each_byte { |b|
|
311
|
+
# res << ('%02x ' % b)
|
312
|
+
# res += "\n" if (n += 1) % 24 == 0
|
313
|
+
# }
|
314
|
+
# res
|
315
|
+
# end
|
316
|
+
# end
|
317
|
+
#
|
318
|
+
#
|
data/ttcrypt.gemspec
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ttcrypt/version'
|
5
|
+
require 'rake'
|
6
|
+
require "rake/extensiontask"
|
7
|
+
require 'rubygems/package_task'
|
8
|
+
|
9
|
+
spec = Gem::Specification.new do |spec|
|
10
|
+
spec.name = "ttcrypt"
|
11
|
+
spec.version = TTCrypt::VERSION
|
12
|
+
spec.authors = ["sergeych"]
|
13
|
+
spec.email = ["real.sergeych@gmail.com"]
|
14
|
+
spec.summary = %q{thrift basic cryptography}
|
15
|
+
spec.description = %q{optimized RSA and other basic cryptography primitives in c++}
|
16
|
+
spec.homepage = ""
|
17
|
+
spec.license = "GPL3+"
|
18
|
+
|
19
|
+
spec.files = `git ls-files -z`.split("\x0")
|
20
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
22
|
+
spec.require_paths = ['lib','ext']
|
23
|
+
|
24
|
+
spec.extensions = FileList["ext/**/extconf.rb"]
|
25
|
+
|
26
|
+
spec.platform = Gem::Platform::RUBY
|
27
|
+
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
29
|
+
spec.add_development_dependency "rake"
|
30
|
+
spec.add_development_dependency "rake-compiler"
|
31
|
+
spec.add_development_dependency "rspec", '>= 2.14.0'
|
32
|
+
|
33
|
+
spec.requirements << 'GMP, https://gmplib.org'
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
# add your default gem packing task
|
38
|
+
Gem::PackageTask.new(spec) do |pkg|
|
39
|
+
end
|
40
|
+
|
41
|
+
Rake::ExtensionTask.new "ttcrypt", spec do |ext|
|
42
|
+
ext.lib_dir = "lib/ttcrypt"
|
43
|
+
ext.source_pattern = "*.{c,cpp}"
|
44
|
+
ext.gem_spec = spec
|
45
|
+
end
|
46
|
+
|
47
|
+
spec
|
metadata
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ttcrypt
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- sergeych
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake-compiler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.14.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.14.0
|
69
|
+
description: optimized RSA and other basic cryptography primitives in c++
|
70
|
+
email:
|
71
|
+
- real.sergeych@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions:
|
74
|
+
- ext/ttcrypt/extconf.rb
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- ext/ttcrypt/.gitignore
|
84
|
+
- ext/ttcrypt/big_integer.cpp
|
85
|
+
- ext/ttcrypt/big_integer.h
|
86
|
+
- ext/ttcrypt/byte_buffer.cpp
|
87
|
+
- ext/ttcrypt/byte_buffer.h
|
88
|
+
- ext/ttcrypt/common_utils.cpp
|
89
|
+
- ext/ttcrypt/common_utils.h
|
90
|
+
- ext/ttcrypt/extconf.rb
|
91
|
+
- ext/ttcrypt/pollard_rho.cpp
|
92
|
+
- ext/ttcrypt/pollard_rho.h
|
93
|
+
- ext/ttcrypt/rsa_key.cpp
|
94
|
+
- ext/ttcrypt/rsa_key.h
|
95
|
+
- ext/ttcrypt/ruby_cpp_tools.cpp
|
96
|
+
- ext/ttcrypt/ruby_cpp_tools.h
|
97
|
+
- ext/ttcrypt/sha1.cpp
|
98
|
+
- ext/ttcrypt/sha1.h
|
99
|
+
- ext/ttcrypt/sha256.c
|
100
|
+
- ext/ttcrypt/sha256.h
|
101
|
+
- ext/ttcrypt/text_utils.cpp
|
102
|
+
- ext/ttcrypt/text_utils.h
|
103
|
+
- ext/ttcrypt/ttcrypt.cpp
|
104
|
+
- ext/ttcrypt/ttcrypt.h
|
105
|
+
- ext/ttcrypt/ttcrypt_ruby.cpp
|
106
|
+
- lib/ttcrypt.rb
|
107
|
+
- lib/ttcrypt/version.rb
|
108
|
+
- spec/spec_helper.rb
|
109
|
+
- spec/ttcrypt_spec.rb
|
110
|
+
- ttcrypt.gemspec
|
111
|
+
homepage: ''
|
112
|
+
licenses:
|
113
|
+
- GPL3+
|
114
|
+
metadata: {}
|
115
|
+
post_install_message:
|
116
|
+
rdoc_options: []
|
117
|
+
require_paths:
|
118
|
+
- lib
|
119
|
+
- ext
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
requirements:
|
131
|
+
- GMP, https://gmplib.org
|
132
|
+
rubyforge_project:
|
133
|
+
rubygems_version: 2.2.2
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: thrift basic cryptography
|
137
|
+
test_files:
|
138
|
+
- spec/spec_helper.rb
|
139
|
+
- spec/ttcrypt_spec.rb
|