rsa-encrypter 0.1.1 → 0.2.1

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/README.md CHANGED
@@ -30,9 +30,9 @@ generate public and private key
30
30
 
31
31
  key = Rsa::Encrypter.generate_rsa
32
32
 
33
- or you can set the both prime numbers manualy, default is 1033, 977 when the both numbers are smaller than is the encrypter faster but lee secure
33
+ or you can set the both prime numbers manualy (1-7), default is 7 (secure but slow) when the secure level smaller than is the encrypter faster but less secure
34
34
 
35
- key = Rsa::Encrypter.generate_rsa(11, 13)
35
+ key = Rsa::Encrypter.generate_rsa(2)
36
36
 
37
37
  a sample message to encrypting (m)
38
38
 
@@ -1,5 +1,5 @@
1
1
  module Rsa
2
2
  module Encrypter
3
- VERSION = "0.1.1"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
data/lib/rsa-encrypter.rb CHANGED
@@ -31,10 +31,12 @@ module Rsa
31
31
  return x
32
32
  end
33
33
 
34
- def self.generate_rsa(a=1033, b=977)
35
-
36
- p = prime?(a)
37
- q = prime?(b)
34
+ def self.generate_rsa(a=5)
35
+ secure = [ [11,13], [61,53], [71,76], [163,181], [443,463], [859,769], [1033,977] ]
36
+ a-=1
37
+ raise "wrong secure level: #{a+1} please use level 1-7" if a > 6 or a < 0
38
+ p = prime?(secure[a][0])
39
+ q = prime?(secure[a][1])
38
40
  n = p * q
39
41
  n2 = (p-1)*(q-1)
40
42
  e = (p+q) -1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsa-encrypter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: