gtk2passwordapp 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/gtk2passwordapp/rnd.rb +16 -15
  2. metadata +7 -27
@@ -2,31 +2,32 @@ module Gtk2Password
2
2
  # This class combines realrand with rand such that
3
3
  # if either one is honest, we'll get honest random numbers.
4
4
  class Rnd
5
- begin
6
- raise "no command line realrand" if $options =~ /-no-gui/
7
- gem 'realrand', '~> 1.0'
8
- require 'random/online'
9
- REALRAND = true
10
- rescue Exception
11
- $stderr.puts $!
12
- REALRAND = false
13
- end
14
5
 
15
6
  BUCKET_LENGTH = 100
16
7
  NUMBERS = [75,10,58,26,94]
17
8
  LCF = 2657850
9
+ RANDOM_ORG = 'http://www.random.org/integers/'
18
10
 
19
11
  attr_reader :bucket, :refilling
20
12
  def initialize
21
- @bucket = []
22
- @refilling = false
23
- self.refill if REALRAND
13
+ begin
14
+ raise "no command line realrand" if $options =~ /-no-gui/
15
+ # Checking if online refill of real random numbers available....
16
+ require 'open-uri'
17
+ require 'timeout'
18
+ @bucket = []
19
+ @refilling = false
20
+ self.refill_timeout
21
+ rescue Exception
22
+ $stderr.puts $!
23
+ @bucket = nil
24
+ @refilling = false
25
+ end
24
26
  end
25
27
 
26
28
  def refill_timeout
27
29
  Timeout.timeout(60) do
28
- generator = Random::RandomOrg.new
29
- @bucket += generator.randnum(BUCKET_LENGTH, 0, LCF - 1)
30
+ @bucket += open("#{RANDOM_ORG}?num=#{BUCKET_LENGTH}&min=0&max=#{LCF-1}&col=#{BUCKET_LENGTH}&format=plain&base=10&rnd=new").read.strip.split(/\s+/).map{|s| s.to_i}
30
31
  end
31
32
  end
32
33
 
@@ -67,7 +68,7 @@ module Gtk2Password
67
68
 
68
69
  def random(number)
69
70
  validate(number)
70
- (REALRAND)? real_random(number) : rand(number)
71
+ (@bucket)? real_random(number) : rand(number)
71
72
  end
72
73
 
73
74
  RND = Rnd.new
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtk2passwordapp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
5
4
  prerelease:
6
- segments:
7
- - 2
8
- - 1
9
- - 0
10
- version: 2.1.0
5
+ version: 2.1.1
11
6
  platform: ruby
12
7
  authors:
13
8
  - carlosjhr64@gmail.com
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-09-19 00:00:00 Z
13
+ date: 2011-10-03 00:00:00 Z
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
16
  name: crypt-tea
@@ -25,11 +20,6 @@ dependencies:
25
20
  requirements:
26
21
  - - "="
27
22
  - !ruby/object:Gem::Version
28
- hash: 27
29
- segments:
30
- - 1
31
- - 3
32
- - 0
33
23
  version: 1.3.0
34
24
  type: :runtime
35
25
  version_requirements: *id001
@@ -41,10 +31,6 @@ dependencies:
41
31
  requirements:
42
32
  - - ~>
43
33
  - !ruby/object:Gem::Version
44
- hash: 49
45
- segments:
46
- - 15
47
- - 3
48
34
  version: "15.3"
49
35
  type: :runtime
50
36
  version_requirements: *id002
@@ -61,14 +47,14 @@ extensions: []
61
47
  extra_rdoc_files: []
62
48
 
63
49
  files:
64
- - ./lib/gtk2passwordapp.rb
65
- - ./lib/gtk2passwordapp/rnd.rb
50
+ - ./lib/gtk2passwordapp/appconfig.rb
51
+ - ./lib/gtk2passwordapp/iocrypt.rb
66
52
  - ./lib/gtk2passwordapp/passwords.rb
67
53
  - ./lib/gtk2passwordapp/passwords_data.rb
68
- - ./lib/gtk2passwordapp/iocrypt.rb
69
- - ./lib/gtk2passwordapp/appconfig.rb
70
- - ./pngs/logo.png
54
+ - ./lib/gtk2passwordapp/rnd.rb
55
+ - ./lib/gtk2passwordapp.rb
71
56
  - ./pngs/icon.png
57
+ - ./pngs/logo.png
72
58
  - README.txt
73
59
  - bin/gtk2passwordapp2
74
60
  homepage: https://sites.google.com/site/gtk2applib/home/gtk2applib-applications/gtk2passwordapp
@@ -84,18 +70,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
70
  requirements:
85
71
  - - ">="
86
72
  - !ruby/object:Gem::Version
87
- hash: 3
88
- segments:
89
- - 0
90
73
  version: "0"
91
74
  required_rubygems_version: !ruby/object:Gem::Requirement
92
75
  none: false
93
76
  requirements:
94
77
  - - ">="
95
78
  - !ruby/object:Gem::Version
96
- hash: 3
97
- segments:
98
- - 0
99
79
  version: "0"
100
80
  requirements:
101
81
  - gtk2