nist_randomness_beacon 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +4 -6
- data/README.md +12 -3
- data/lib/nist_randomness_beacon.rb +5 -5
- data/lib/nist_randomness_beacon/client.rb +11 -11
- data/lib/nist_randomness_beacon/version.rb +1 -1
- data/nist_randomness_beacon.gemspec +5 -8
- metadata +7 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6336f1cb50b891524b88a874af6c508b3f0c2498
|
|
4
|
+
data.tar.gz: 0271cce375a9ac9d60d16ddda2acc087d947c80e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c1df5e16ed9e97415f3020c1a805ba064fc14d954b93fba04ef209da3332df91a20ee3b6e49e5d4ef44e964b60c9aba7c4aa5b82737070ea8710dc883b2f99df
|
|
7
|
+
data.tar.gz: 665862cc39ddf2fa8d1ed24cc41b97bb5eee64ab5c7b08517f97087c5878944a2d23c1a25a0fa25566a997125d2cced13dd70ca8f9ded5651f3985e7021952ed
|
data/CONTRIBUTING.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# Contributing
|
|
2
2
|
|
|
3
|
-
1. Fork it
|
|
4
|
-
1.
|
|
5
|
-
1.
|
|
6
|
-
1.
|
|
7
|
-
1. Push to the branch (`git push origin my-new-feature`)
|
|
8
|
-
1. Create a new Pull Request
|
|
3
|
+
1. [Fork it](https://github.com/chaserx/nist_randomness_beacon/fork).
|
|
4
|
+
1. Please follow the [style guide](http://learning-things.cirrusmio.com/style-guides/ruby.html).
|
|
5
|
+
1. Commit and push your changes to Github.
|
|
6
|
+
1. [Create a new Pull Request](https://github.com/chaserx/nist_randomness_beacon/compare).
|
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# NIST Randomness Beacon
|
|
2
2
|
|
|
3
3
|
A wrapper for the NIST Randomness Beacon 'cause sometimes you need to get
|
|
4
|
-
a 512-bit full-entropy bit-string
|
|
4
|
+
a 512-bit full-entropy bit-string programmatically. You never know.
|
|
5
5
|
|
|
6
6
|
Inspiration: http://hackaday.com/2014/12/19/nist-randomness-beacon/
|
|
7
7
|
|
|
@@ -29,13 +29,22 @@ Or install it yourself as:
|
|
|
29
29
|
|
|
30
30
|
```ruby
|
|
31
31
|
require 'nist_randomness_beacon'
|
|
32
|
-
|
|
32
|
+
client = NISTRandomnessBeacon::Client.new
|
|
33
|
+
record = client.last
|
|
33
34
|
# => NISTRandomnessBeacon::Record
|
|
34
35
|
record.output_value
|
|
35
36
|
# => "4838827EDEE67CD5F58139933709764D1C51B4FC362DCAAB06B1572AC533F15F648F5EA98C5276187EBB87148852AEE291DB735F821CDC04E53DD7331AB1D3B6"
|
|
37
|
+
|
|
38
|
+
# Pass an optional time to initialize:
|
|
39
|
+
three_days = 3 * 24 * 60 * 60
|
|
40
|
+
client = NISTRandomnessBeacon::Client.new(Time.now - three_days)
|
|
41
|
+
record = client.current
|
|
42
|
+
record.output_value
|
|
43
|
+
# => "1B080E1C3B8A8A0FFA51831B1F830D23CE66C2FF47BF35361CF05D8095CA0AFC69A78D6711774C2653108CA355C3EA4A63926655452048A4B211BC871FC812F8"
|
|
36
44
|
```
|
|
37
45
|
|
|
38
|
-
WARNING: DO NOT USE BEACON
|
|
46
|
+
WARNING: DO NOT USE BEACON-GENERATED VALUES AS SECRET CRYPTOGRAPHIC KEYS. See
|
|
47
|
+
[this StackExchange thread](http://crypto.stackexchange.com/questions/15225/how-useful-is-nists-randomness-beacon-for-cryptographic-use).
|
|
39
48
|
|
|
40
49
|
## Contributing
|
|
41
50
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
require_relative 'nist_randomness_beacon/version'
|
|
2
|
+
require_relative 'nist_randomness_beacon/client'
|
|
3
|
+
require_relative 'nist_randomness_beacon/record'
|
|
4
|
+
require_relative 'nist_randomness_beacon/service_error'
|
|
5
|
+
require_relative 'nist_randomness_beacon/underscore'
|
|
@@ -4,21 +4,21 @@ require 'json'
|
|
|
4
4
|
module NISTRandomnessBeacon
|
|
5
5
|
# Client to the Randomness Beacon API
|
|
6
6
|
class Client
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
attr_accessor :timestamp
|
|
7
|
+
DEFAULT_URI = 'https://beacon.nist.gov/rest/record'.freeze
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
include HTTParty
|
|
10
|
+
attr_reader :timestamp, :uri
|
|
12
11
|
|
|
13
|
-
def initialize
|
|
14
|
-
@timestamp =
|
|
12
|
+
def initialize time=nil, uri=DEFAULT_URI
|
|
13
|
+
@timestamp = (time || Time.now).to_i
|
|
14
|
+
@uri = uri
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
# Returns the Current Record (or next closest)
|
|
18
18
|
# https://beacon.nist.gov/rest/record/<timestamp>
|
|
19
19
|
#
|
|
20
20
|
def current
|
|
21
|
-
response = self.class.get("
|
|
21
|
+
response = self.class.get("#@uri/#@timestamp")
|
|
22
22
|
raise ServiceError, response.body unless response.code.eql? 200
|
|
23
23
|
NISTRandomnessBeacon::Record.new(response.parsed_response['record'])
|
|
24
24
|
end
|
|
@@ -27,7 +27,7 @@ module NISTRandomnessBeacon
|
|
|
27
27
|
# https://beacon.nist.gov/rest/record/previous/<timestamp>
|
|
28
28
|
#
|
|
29
29
|
def previous
|
|
30
|
-
response = self.class.get("
|
|
30
|
+
response = self.class.get("#@uri/previous/#@timestamp")
|
|
31
31
|
raise ServiceError, response.body unless response.code.eql? 200
|
|
32
32
|
NISTRandomnessBeacon::Record.new(response.parsed_response['record'])
|
|
33
33
|
end
|
|
@@ -36,7 +36,7 @@ module NISTRandomnessBeacon
|
|
|
36
36
|
# https://beacon.nist.gov/rest/record/next/<timestamp>
|
|
37
37
|
#
|
|
38
38
|
def next
|
|
39
|
-
response = self.class.get("
|
|
39
|
+
response = self.class.get("#@uri/next/#@timestamp")
|
|
40
40
|
raise ServiceError, response.body unless response.code.eql? 200
|
|
41
41
|
NISTRandomnessBeacon::Record.new(response.parsed_response['record'])
|
|
42
42
|
end
|
|
@@ -45,7 +45,7 @@ module NISTRandomnessBeacon
|
|
|
45
45
|
# https://beacon.nist.gov/rest/record/last
|
|
46
46
|
#
|
|
47
47
|
def last
|
|
48
|
-
response = self.class.get("
|
|
48
|
+
response = self.class.get("#@uri/last")
|
|
49
49
|
raise ServiceError, response.body unless response.code.eql? 200
|
|
50
50
|
NISTRandomnessBeacon::Record.new(response.parsed_response['record'])
|
|
51
51
|
end
|
|
@@ -54,7 +54,7 @@ module NISTRandomnessBeacon
|
|
|
54
54
|
# https://beacon.nist.gov/rest/record/start-chain/<timestamp>
|
|
55
55
|
#
|
|
56
56
|
def start_chain
|
|
57
|
-
response = self.class.get("
|
|
57
|
+
response = self.class.get("#@uri/start-chain/#@timestamp")
|
|
58
58
|
raise ServiceError, response.body unless response.code.eql? 200
|
|
59
59
|
NISTRandomnessBeacon::Record.new(response.parsed_response['record'])
|
|
60
60
|
end
|
|
@@ -6,13 +6,10 @@ require 'nist_randomness_beacon/version'
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "nist_randomness_beacon"
|
|
8
8
|
spec.version = NISTRandomnessBeacon::VERSION
|
|
9
|
-
spec.authors = ["Chase Southard"]
|
|
9
|
+
spec.authors = ["Chase Southard", "Sarah Vessels"]
|
|
10
10
|
spec.email = ["chase.southard@gmail.com"]
|
|
11
|
-
spec.summary = %q{A wrapper for NIST Randomness Beacon}
|
|
12
|
-
spec.description = %q{A wrapper for the NIST Randomness Beacon
|
|
13
|
-
'cause sometimes you need to get
|
|
14
|
-
a 512-bit full-entropy bit-string programmaticlly.
|
|
15
|
-
You never know.}
|
|
11
|
+
spec.summary = %q{A wrapper for the National Institute of Standards and Technology (NIST) Randomness Beacon.}
|
|
12
|
+
spec.description = %q{A wrapper for the National Institute of Standards and Technology (NIST) Randomness Beacon 'cause sometimes you need to get a 512-bit full-entropy bit-string programmatically. You never know.}
|
|
16
13
|
spec.homepage = "https://github.com/chaserx/nist_randomness_beacon"
|
|
17
14
|
spec.license = "MIT"
|
|
18
15
|
|
|
@@ -22,8 +19,8 @@ Gem::Specification.new do |spec|
|
|
|
22
19
|
spec.require_paths = ["lib"]
|
|
23
20
|
spec.required_ruby_version = '> 2.0'
|
|
24
21
|
|
|
25
|
-
spec.add_development_dependency
|
|
26
|
-
spec.add_development_dependency
|
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
|
27
24
|
spec.add_development_dependency 'awesome_print', '~> 1.2.0'
|
|
28
25
|
spec.add_development_dependency 'yard', '~> 0.8.7.6'
|
|
29
26
|
spec.add_development_dependency 'rspec', '~> 3.1.0'
|
metadata
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nist_randomness_beacon
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chase Southard
|
|
8
|
+
- Sarah Vessels
|
|
8
9
|
autorequire:
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
@@ -164,11 +165,9 @@ dependencies:
|
|
|
164
165
|
- - '='
|
|
165
166
|
- !ruby/object:Gem::Version
|
|
166
167
|
version: 1.8.1
|
|
167
|
-
description:
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
a 512-bit full-entropy bit-string programmaticlly.
|
|
171
|
-
You never know.
|
|
168
|
+
description: A wrapper for the National Institute of Standards and Technology (NIST)
|
|
169
|
+
Randomness Beacon 'cause sometimes you need to get a 512-bit full-entropy bit-string
|
|
170
|
+
programmatically. You never know.
|
|
172
171
|
email:
|
|
173
172
|
- chase.southard@gmail.com
|
|
174
173
|
executables: []
|
|
@@ -219,7 +218,8 @@ rubyforge_project:
|
|
|
219
218
|
rubygems_version: 2.2.2
|
|
220
219
|
signing_key:
|
|
221
220
|
specification_version: 4
|
|
222
|
-
summary: A wrapper for NIST Randomness
|
|
221
|
+
summary: A wrapper for the National Institute of Standards and Technology (NIST) Randomness
|
|
222
|
+
Beacon.
|
|
223
223
|
test_files:
|
|
224
224
|
- spec/cassettes/current.yml
|
|
225
225
|
- spec/cassettes/last.yml
|