secretsharing 1.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f098c9c10d0baf1c9fe59f3e78ac25fd328b562
4
- data.tar.gz: 066705c6051aece363ef1fc94cc52afe74e84837
3
+ metadata.gz: ed7cefd0fcae8cc2d1d8224c76e57ece7adf7d5f
4
+ data.tar.gz: bbc9761d15c080aabecf6ddbcae363aaf80d6770
5
5
  SHA512:
6
- metadata.gz: 658a169db761f026d7521bf8def8ca80ca93d599d99f062ddcd49a4da163a72b204532bb05ef186988d3c200fbc0d2b5bbef407fda5926210f1bd69380de5ad1
7
- data.tar.gz: 2c267a45c04ff7dbb20d00b393c418a523645b5596a3a1b1090fec1f812ef87e7af6861032cba297dccf9ce673a0383905d5a0db7137e0d1ad7db079d0066996
6
+ metadata.gz: c77bec8f6362df45d14202354dce567063451343c10909cb5199c09b161864b065d81d4102f3495c243ff9650b59a7a95484859158994e48b9c114917ef817b2
7
+ data.tar.gz: 6e6b76852a12212eb81ef863cf360766aea8867323d0a0ebc6fcb25b6a36ca4696d522f3427a0ab40f986223c1c62c005fceeffe63548a2f55c0a7e6c7576d40
@@ -27,3 +27,6 @@ AbcSize:
27
27
 
28
28
  GuardClause:
29
29
  MinBodyLength: 5
30
+
31
+ NumericLiterals:
32
+ Enabled: false
@@ -3,14 +3,17 @@ language: ruby
3
3
  gemfile: gemfiles/Gemfile.ci
4
4
 
5
5
  rvm:
6
- - 2.2.0
7
- - 2.1.5
8
6
  - 2.0.0
9
- - 1.9.3
10
- - 1.9.2
11
- - 1.8.7
7
+ - 2.1.4
8
+ - 2.2.2
9
+ - ruby-head
10
+ - jruby
12
11
  - jruby-head
13
- - jruby-19mode
14
- - jruby-18mode
15
- - rbx-2.4.1
16
- - ree
12
+ - rbx-2
13
+
14
+ matrix:
15
+ fast_finish: true
16
+ allow_failures:
17
+ - rvm: ruby-head
18
+ - rvm: jruby-head
19
+ - rvm: rbx-2
@@ -0,0 +1,40 @@
1
+ # CHANGELOG
2
+
3
+ ## v2.0.1
4
+
5
+ - Update gemspec description, no longer maintained.
6
+
7
+ ## v2.0.0
8
+
9
+ - Use RbNaCl for SHA-512 hash and HMAC SHA-256. Backward incompatible change with previous use of SHA-256.
10
+ - Refactored to eliminate use of OpenSSL::BN in favor of Ruby Bignum. Its better documented and the code is more intentional. As of [Ruby 2.1](http://globaldev.co.uk/2014/05/ruby-2-1-in-detail/) Bignum uses the GNU Multiple Precision Arithmetic Library (GMP) to improve performance.
11
+ - New internal prime number generation using Miller-Rabin primality tests which eliminates previous OpenSSL::BN#generate_prime bugs.
12
+ - Use RbNaCl to generate random numbers.
13
+ - Change the list of supported Ruby VMs to match RbNaCl.
14
+ - Use backports gem to support Bignum#bit_length which was introduced in Ruby 2.1
15
+ - Fixed all Rubocop warnings.
16
+ - 100% code test coverage as measured with COCO.
17
+ - Use RbNaCl secure constant-time comparison for comparing secret objects to one another.
18
+ - Added additional tests for utility functions.
19
+
20
+ ## v1.0.0
21
+
22
+ - Version 1.0.0 is an almost complete rewrite of the original code.
23
+ This version is NOT backwards compatible with the shares generated
24
+ with previous version. The API for this version is significantly
25
+ changed as well. You will need to make some (hopefully simple)
26
+ code changes to use this newer version. See the README.md file
27
+ for details.
28
+
29
+ ## v0.3
30
+
31
+ - Added support for setting your own secret using the set_fixed_secret() method.
32
+
33
+ ## v0.2
34
+
35
+ - Bugfix in Langrange interpolation, which broke 2/2 sharing.
36
+ - Added secret_password method to represent the secret in Base64.
37
+
38
+ ## v0.1
39
+
40
+ - Initial version
data/README.md CHANGED
@@ -1,87 +1,126 @@
1
1
  # SecretSharing
2
2
 
3
+ # IMPORTANT NEWS
4
+
5
+ **April 2016 - THIS GEM IS NO LONGER MAINTAINED**
6
+
7
+ **Good news?** There is a newer better one!
8
+
9
+ I have created a new `tss` [https://github.com/grempe/tss-rb](https://github.com/grempe/tss-rb)
10
+ Ruby Gem (with CLI) that implements Threshold Secret Sharing.
11
+
12
+ The new version is based on a mature specification, written by a professional
13
+ Cryptogropher, and is compatible with at least one other Python implementation
14
+ of that spec at the share level. It is **NOT** compatible with this
15
+ `secretsharing` gem. There are a number of features of the new code which make
16
+ it a better choice not the least of which are:
17
+
18
+ * MUCH cleaner API, only two entry points (`TSS.split`, `TSS.combine`)
19
+ * Split any arbitrary UTF-8 or US-ASCII String
20
+ * SHA256 or SHA1 verification of every secret recovered
21
+ * Verification hash is split along with the secret, the hash is not known to an attacker
22
+ * A binary header with a unique identifier, and the threshold number of shares needed, no more guessing
23
+ * More effective sanitization of args, and verification of share formats
24
+ * Much cleaner codebase, which closely follows the spec as documented
25
+ * Fewer dependencies
26
+ * Cryptographically Signed Gem and repository
27
+ * Binary and Text share format
28
+ * Great test coverage.
29
+
30
+ You can find the new code at:
31
+
32
+ [GitHub : https://github.com/grempe/tss-rb](https://github.com/grempe/tss-rb)
33
+
34
+ [RubyGems : https://rubygems.org/gems/tss](https://rubygems.org/gems/tss)
35
+
36
+
3
37
  ## Description
4
- A Ruby gem for sharing secrets in an information-theoretically secure way.
38
+ A Ruby gem for sharing secrets using [Shamir's Secret Sharing](http://en.wikipedia.org/wiki/Shamir's_Secret_Sharing), which is an [information-theoretic](https://en.wikipedia.org/wiki/Information-theoretic_security) secure method to share secrets between trusted parties.
5
39
 
6
- It uses Shamir's secret sharing to enable sharing a (random) secret
7
- between n persons where k <= n shares are enough to recover the secret.
40
+ Shamir's Secret Sharing is an algorithm in cryptography created by Adi Shamir. It is a form of secret sharing, where a secret is divided into parts, giving each participant its own unique part, where some of the parts or all of them are needed in order to reconstruct the secret.
8
41
 
9
- k-1 secret share holders learn nothing about the secret when they combine their shares.
42
+ Counting on all participants to combine together the secret might be impractical, and therefore sometimes the threshold scheme is used where any `k` of the total shares `n` are sufficient to reconstruct the original secret.
10
43
 
11
- Learn More about [Shamir's Secret Sharing](http://en.wikipedia.org/wiki/Shamir's_Secret_Sharing)
44
+ `k - 1` secret share holders can learn *nothing* about the secret, even when they combine their shares with others. Only once the `k` threshold of shares combined is reached will the original secret be revealed.
12
45
 
13
46
  ## Development History
14
47
 
15
- This library is based on the OpenXPKI::Crypto::Secret::Split Perl module
16
- used in the open source PKI software OpenXPKI, which was written by
17
- Alexander Klink for the OpenXPKI project in 2006.
48
+ This library was originally developed by Alexander Klink and later significantly enhanced by Glenn Rempe. You may find the [original source code](http://repo.or.cz/w/secretsharing.git) for Alexander's version still online.
49
+
50
+ The canonical home for the Gem is now at [grempe/secretsharing](https://github.com/grempe/secretsharing).
18
51
 
19
- The original source code for Alexander Klink's 'secretsharing' gem
20
- can be found at <http://repo.or.cz/w/secretsharing.git>
52
+ WARNING : The major release versions of the Gem may not be API or file compatible with each other.
21
53
 
22
- It has been further enhanced, modularized, and a full test suite
23
- has been added by Glenn Rempe (<glenn@rempe.us>) and can be found
24
- at <https://github.com/grempe/secretsharing> which is the new canonical
25
- repository for the gem.
54
+ ## Is it safe?
26
55
 
27
- WARNING : The public API and the Share String format of the current version
28
- of the Gem are *not* backwards compatible with 'secretsharing'
29
- versions <= '0.3'.
56
+ This code has not yet been tested in production by the author. It is well tested though with a full Minitest suite and 100% test code coverage. By all appearances it is working well for what it was designed to do. The code also undergoes a continuous integration test run on many different Ruby runtimes after every push.
30
57
 
31
- ## Should I use it?
58
+ The mathematics of the code, which are critical to its operation, and its suitability for use as a security product have not yet been vetted by security minded experts. If you want to help with this please do get in touch.
32
59
 
33
- This code has not yet been tested in production. It is seemingly well tested though with a full Minitest suite and 100% test code coverage and appears to be working well for what it was designed to do. The code also undergoes a continuous integration test run on many different Ruby runtimes upon every push.
60
+ ## Supported platforms
34
61
 
35
- The mathematics of the code, which is critical to its operation, and its suitability for use as a security product have not yet been tested or verified by security minded folks. `Yet`. If you are one of those strongly mathematically or security minded folks please do get in touch if you think you can help validate the current implementation. Suggestions or concerns welcome.
62
+ You should be able to use `secretsharing` anywhere that [RbNaCl](https://github.com/cryptosphere/rbnacl) is supported and we do continuous integration testing on the following Rubies:
63
+
64
+ * MRI 2.0.0, 2.1.4, 2.2.2, HEAD
65
+ * JRuby
66
+ * JRuby HEAD
67
+ * Rubinius
36
68
 
37
69
  ## Installation
38
70
 
39
- Add this line to your application's Gemfile:
71
+ Add this to your application's Gemfile:
40
72
 
41
73
  gem 'secretsharing'
42
74
 
43
- And then execute:
75
+ And then:
44
76
 
45
77
  $ bundle
46
78
 
47
- Or install it yourself as:
79
+ Or install it directly:
48
80
 
49
81
  $ gem install secretsharing
50
82
 
51
- ## Usage in a Ruby/Rails project.
83
+ Installation also adds a `secretsharing` binary which you can use as a simple CLI for creating and restoring secret shares.
84
+
85
+ ## Example usage in a Ruby program
52
86
 
53
87
  require 'secretsharing'
54
88
 
55
- # create an object for 3 out of 5 secret sharing
89
+ # create a container (c1) for 3 out of 5 secret sharing
56
90
  c1 = SecretSharing::Shamir::Container.new(5,3)
57
91
 
58
- # create a random secret (returns the secret)
92
+ # create a default secret object with a 32 Byte (256 bit) random secret embedded
59
93
  c1.secret = SecretSharing::Shamir::Secret.new
60
94
 
61
- # (or create a fixed secret of your choice by passing in an OpenSSL::BN object in the :secret arg)
62
- c1.secret = SecretSharing::Shamir::Secret.new(:secret => OpenSSL::BN.new('123456789'))
95
+ # or create a fixed secret of your choice by passing in a sufficiently
96
+ # large, cryptographically secure, Integer in the :secret arg
97
+ c1.secret = SecretSharing::Shamir::Secret.new(:secret => 123456789)
63
98
 
64
- # show secret
99
+ # show the internal secret (a Bignum), as a Base64 encoded String
65
100
  puts c1.secret
66
101
 
67
- # show shares
102
+ # show the Base64 encoded shares generated from that secret
68
103
  c1.shares.each { |share| puts share }
69
104
 
70
- # recover secret from shares by using a new Container
71
- # where the number of Shares expected is the same.
105
+ # recover secret from shares by using a new Container (c2)
106
+ # where the number of Shares expected is the same (passing a single
107
+ # argument sets both `n` and `k` to the same value).
72
108
  c2 = SecretSharing::Shamir::Container.new(3)
73
109
 
74
- # Accepts SecretSharing::Shamir::Share objects or
75
- # string representations thereof
76
- c2 << c1.shares[0]
77
- c2 << c1.shares[2]
78
- c2 << c1.shares[4]
110
+ # the container accepts pushing any SecretSharing::Shamir::Share objects or Strings
111
+ # `c2` will return `false` each time until a valid secret is recovered.
112
+ c2 << c1.shares[0] #=> false
113
+ c2 << c1.shares[2] #=> false
114
+ c2 << c1.shares[4] #=> #<SecretSharing::Shamir::Secret ...>
79
115
 
116
+ # when enough shares are present, the secret will be populated.
80
117
  c2.secret? #=> true
118
+
119
+ # show the recovered secret (Base64 encoded)
81
120
  puts c2.secret
82
121
 
83
- # Test that the secret used to generate the HMAC
84
- # matches the HMAC of the secret that was re-constructed
122
+ # test that the newly recovered secret matches the original secret used to create
123
+ # the shares by comparing the embedded HMAC SHA-512 of both.
85
124
  c2.secret.valid_hmac? #=> true
86
125
 
87
126
  ## Usage via the command line CLI
@@ -89,7 +128,7 @@ Or install it yourself as:
89
128
  First, use the `secretsharing` program to generate a set of Shares from a Secret
90
129
 
91
130
  ````
92
- ➜ secretsharing git:(master) ✗ secretsharing
131
+ $ secretsharing
93
132
 
94
133
  Shamir's Secret Sharing
95
134
 
@@ -98,47 +137,43 @@ Would you like to 'encode' a new secret as shares, or 'decode' one from existing
98
137
  2. decode
99
138
  Action? 1
100
139
 
101
- Would you like to create a 'random' secret, or will you provide a 'fixed' one?
140
+ Would you like to create a random 32 Byte secret, or will you provide your own (large Integer)?
102
141
  1. random
103
142
  2. fixed
104
- Type? 1
143
+ Type? 2
144
+ Enter your numeric password: 123456789
105
145
  How many total shares (n) do you want to distribute? 5
106
- How many of the total shares (k) are required to reveal the secret? 3
146
+ How many of the total shares are required to reveal the secret (k)? 3
107
147
 
108
148
  ========================================
109
- Encoded Secret:
149
+ Secret Split Complete
110
150
 
111
151
  (k) Value: 3
112
152
  (n) Value: 5
113
153
 
114
154
  Secret (Bignum):
115
- 179040077567401061920833455639501686558874997550289562553628622313673068089718
155
+ 123456789
116
156
 
117
157
  Secret (Base64 Compacted & URL Safe):
118
- OXY1eHdod3N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xNzRhMDVmYjllMzY2YjQ3YThlZWNmNDcwZiIsImsiOjMsIm4iOjUsIngiOjUsInkiOjIyNjY3ODMyNiwicHJpbWUiOjc0NDk2NzMzNywicHJpbWVfYml0bGVuZ3RoIjoyOX0=
133
169
 
134
170
  ========================================
135
- ➜ secretsharing git:(master) ✗
136
171
  ````
137
172
 
138
173
  Once that is done you can re-hydrate your Secret using any 3 out of the 5 Shares originally generated:
139
174
 
140
175
  ````
141
- ➜ secretsharing git:(master) ✗ secretsharing
176
+ $ secretsharing
142
177
 
143
178
  Shamir's Secret Sharing
144
179
 
@@ -150,25 +185,23 @@ Action? 2
150
185
  How many of shares (k) are required to reveal this secret? 3
151
186
 
152
187
  Enter the '3' shares one at a time with a RETURN after each:
153
- 2gEqeyJobWFjIjoiMDVkNWNlOTIyNjk5ZTUxNzY4ODU2MmJlYjJiZDUzMTI4OTAyYTYzMjAxMjIxMjdjZTVhZjhlMmRiMmY2MmNkMiIsImsiOjMsIm4iOjUsInByaW1lIjozNzA1MzQ2ODU1NTk0MTE4MjUzNTU0MjcxNTIwMjc4MDEzMDUxMzA0NjM5NTA5MzAwNDk4MDQ5MjYyNjQyNjg4MjUzMjIwMTQ4NDc4MDU5LCJwcmltZV9iaXRsZW5ndGgiOjI2MSwidmVyc2lvbiI6MSwieCI6MSwieSI6OTE5NjU5ODE1Njg0MzAwODU5Mjg2OTU1ODMxMzg0NzA2NDQ1NTMyMzQxNDE5ODAyOTA5NzEwMDcxODU1MTgwMjUyMTYxMjk4Nzg0MzE2fQ==
154
- 2gEreyJobWFjIjoiMDVkNWNlOTIyNjk5ZTUxNzY4ODU2MmJlYjJiZDUzMTI4OTAyYTYzMjAxMjIxMjdjZTVhZjhlMmRiMmY2MmNkMiIsImsiOjMsIm4iOjUsInByaW1lIjozNzA1MzQ2ODU1NTk0MTE4MjUzNTU0MjcxNTIwMjc4MDEzMDUxMzA0NjM5NTA5MzAwNDk4MDQ5MjYyNjQyNjg4MjUzMjIwMTQ4NDc4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jNlMjJlNmRhMjcyNzljNDhmZDcxZDBiZmJmNGZlNzk3NGRkYzkxNzRhMDVmYjllMzY2YjQ3YThlZWNmNDcwZiIsImsiOjMsIm4iOjUsIngiOjMsInkiOjU5OTAyOTc2NSwicHJpbWUiOjc0NDk2NzMzNywicHJpbWVfYml0bGVuZ3RoIjoyOX0=
156
191
 
157
192
 
158
193
  ========================================
159
- Decoded Secret:
194
+ Secret Recovery Complete
160
195
 
161
196
  (k) Value: 3
162
197
 
163
- Secret (Bignum):
164
- 179040077567401061920833455639501686558874997550289562553628622313673068089718
165
-
166
- Secret (Base64 Compacted & URL Safe):
167
- OXY1eHdod3N0NXJ1MWEzZXBuMjgxZnN1Y2Y4dXI1bWRyNG40dTl2Zmk1MG16OXM4emE=
198
+ Secret (Fixnum):
199
+ 123456789
168
200
 
201
+ Secret (URL safe Base64 encoded):
202
+ MjFpM3Y5
169
203
 
170
204
  ========================================
171
- ➜ secretsharing git:(master) ✗
172
205
  ````
173
206
 
174
207
  Easy!
@@ -193,7 +226,7 @@ Build and Install the gem to your local system from the cloned repository:
193
226
 
194
227
  Run the `secretsharing` binary without installing the Gem locally:
195
228
 
196
- ruby -I./lib bin/secretsharing
229
+ bundle exec ruby -I./lib bin/secretsharing
197
230
 
198
231
  ### Code Quality:
199
232
 
@@ -207,10 +240,9 @@ We love bug reports and pull requests.
207
240
 
208
241
  [![Build Status](https://travis-ci.org/grempe/secretsharing.png)](https://travis-ci.org/grempe/secretsharing)
209
242
 
210
- This gem is tested after each git push to the master branch
211
- using the [Travis CI](https://travis-ci.org/grempe/secretsharing) automated build and test service against several versions of a the most popular Ruby runtimes (MRI 1.8.7, 1.9.3, 2.0.0, JRuby, REE, Rubinious). A build must be green on all of them to be considered for release.
243
+ This gem is tested after each git push to the master branch using the [Travis CI](https://travis-ci.org/grempe/secretsharing) automated build and test service against the supported Ruby runtimes.
212
244
 
213
- A `.travis.yml` file has been added to this project to define which Ruby versions will be tested. Additionally a `gemfiles/Gemfile.ci` file has been created to specify a custom minimal Gemspec to be run on the test hosts. Contributors are not to modify these files.
245
+ A `.travis.yml` file has been added to this project to define which Ruby versions will be tested. Additionally a `gemfiles/Gemfile.ci` file has been created to specify a custom minimal Gemspec to be run on the test hosts. Contributors should not need to modify these files.
214
246
 
215
247
  #### Code Climate
216
248
 
@@ -224,17 +256,17 @@ Code quality and metrics over time are being monitored courtesy of [Code Climate
224
256
 
225
257
  [RuboCop](https://github.com/bbatsov/rubocop) is a Ruby static code analyzer. Out of the box it will enforce many of the guidelines outlined in the community [Ruby Style Guide](https://github.com/bbatsov/ruby-style-guide). A clean `rubocop` run against all `lib` and `spec` code is necessary for a build to be considered for release.
226
258
 
227
- A `.rubocop.yml` file has been added to this project to define any style exceptions. Contributors are not to modify this file.
259
+ A `.rubocop.yml` file has been added to this project to define any style exceptions. Contributors should not need to modify this file.
228
260
 
229
261
  #### COCO
230
262
 
231
- The [COCO](http://lkdjiin.github.io/coco/) gem provides automatic test code coverage analysis for ruby 1.9.2, 1.9.3 and 2.0. It will be run every time `rake test` is run. If there are any files that are not 100% covered an output report will be generated in `coverage/index.html' and a summary line will be added at the end of the `rake test` output. It is expected that 100% test coverage will be maintained.
263
+ The [COCO](http://lkdjiin.github.io/coco/) gem provides automatic test code coverage analysis for MRI Rubies. It will be run every time `rake test` is run. If there are any files that are not 100% covered an output report will be generated in `coverage/index.html' and a summary line will be added at the end of the `rake test` output. It is expected that 100% test coverage will be maintained.
232
264
 
233
- A `.coco.yml` file has been added to this project to define any coverage exceptions. Contributors are not to modify this file.
265
+ A `.coco.yml` file has been added to this project to define any coverage exceptions. Contributors should not need to modify this file.
234
266
 
235
267
  #### Semantic Versioning
236
- This Gem, and its version number, tries its best to adhere to the
237
- 'Semantic Versioning' strategy espoused at : <http://semver.org>
268
+ This Gems version number tries its best to adhere to
269
+ [Semantic Versioning](http://semver.org).
238
270
 
239
271
  ### Contributing
240
272
 
@@ -244,7 +276,7 @@ This Gem, and its version number, tries its best to adhere to the
244
276
  Please ensure that you maintain 100% test code coverage as reported by 'coco' which is run after every `rake test` automatically.
245
277
  Please run the `rubocop` tool to ensure you are consistent with Ruby style guidelines for this project.
246
278
 
247
- 1. Fork it
279
+ 1. Fork the repository
248
280
  2. Create your feature branch (`git checkout -b my-new-feature`)
249
281
  3. Commit your changes (`git commit -am 'Add some feature'`)
250
282
  4. Push to the branch (`git push origin my-new-feature`)
data/Rakefile CHANGED
@@ -4,9 +4,9 @@ require 'bundler/gem_tasks'
4
4
  require 'rake/testtask'
5
5
 
6
6
  Rake::TestTask.new do |t|
7
- t.pattern = "spec/*_spec.rb"
8
- t.verbose = true
9
- t.warning = false
7
+ t.pattern = 'spec/*_spec.rb'
8
+ t.verbose = false
9
+ t.warning = true
10
10
  end
11
11
 
12
12
  task :default => 'test'
@@ -35,7 +35,7 @@ end
35
35
 
36
36
  if choices[:action] == :encode
37
37
 
38
- say("\nWould you like to create a 'random' secret, or will you provide a 'fixed' one?\n")
38
+ say("\nWould you like to create a random 32 Byte secret, or will you provide your own (large Integer)?\n")
39
39
  choose do |menu|
40
40
  menu.prompt = 'Type? '
41
41
 
@@ -53,18 +53,18 @@ if choices[:action] == :encode
53
53
  end
54
54
 
55
55
  choices[:secret_n] = ask('How many total shares (n) do you want to distribute? ', Integer) { |q| q.in = 2..512 }
56
- choices[:secret_k] = ask('How many of the total shares (k) are required to reveal the secret? ', Integer) { |q| q.in = 2..512 }
56
+ choices[:secret_k] = ask('How many of the total shares are required to reveal the secret (k)? ', Integer) { |q| q.in = 2..512 }
57
57
 
58
58
  @c = SecretSharing::Shamir::Container.new(choices[:secret_n], choices[:secret_k])
59
59
 
60
60
  if choices[:secret_type] == :fixed
61
- @c.secret = SecretSharing::Shamir::Secret.new(:secret => OpenSSL::BN.new(choices[:secret_password].to_s))
61
+ @c.secret = SecretSharing::Shamir::Secret.new(:secret => choices[:secret_password])
62
62
  else
63
63
  @c.secret = SecretSharing::Shamir::Secret.new
64
64
  end
65
65
 
66
66
  say("\n========================================\n")
67
- say("Encoded Secret:\n\n")
67
+ say("Secret Split Complete\n\n")
68
68
  say("(k) Value: #{choices[:secret_k]}\n")
69
69
  say("(n) Value: #{choices[:secret_n]}\n")
70
70
  say("\n")
@@ -97,13 +97,13 @@ elsif choices[:action] == :decode
97
97
  say("\n")
98
98
  if @c.secret?
99
99
  say("\n========================================\n")
100
- say("Decoded Secret:\n\n")
100
+ say("Secret Recovery Complete\n\n")
101
101
  say("(k) Value: #{choices[:secret_k]}\n")
102
102
  say("\n")
103
- say("Secret (Bignum): \n")
103
+ say("Secret (#{@c.secret.secret.class}): \n")
104
104
  say(@c.secret.secret.to_s)
105
105
  say("\n")
106
- say("Secret (Base64 Compacted & URL Safe): \n")
106
+ say("Secret (URL safe Base64 encoded): \n")
107
107
  say(@c.secret.to_s)
108
108
  say("\n")
109
109
  say("\n========================================\n")