Module: HELPEMA::SSSS
- Defined in:
- lib/helpema/ssss.rb
Class Method Summary collapse
- .combine(*pwds) ⇒ Object
-
.split(secret, t0 = 2, n0 = 3, t: t0, n: n0, threshold: t, shares: n, w: nil, s: nil, x: false, token: w, level: s, hexmode: x) ⇒ Object
Note how the function mirrors the command line options.
Class Method Details
.combine(*pwds) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/helpema/ssss.rb', line 24 def self.combine(*pwds) pwd = '' Open3.popen3("ssss-combine -q -t #{pwds.length}") do |stdin, stdout, stderr| pwds.each{|p| stdin.puts p} stdin.close pwd = stderr.read.split("\n").last end return pwd end |
.split(secret, t0 = 2, n0 = 3, t: t0, n: n0, threshold: t, shares: n, w: nil, s: nil, x: false, token: w, level: s, hexmode: x) ⇒ Object
Note how the function mirrors the command line options.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/helpema/ssss.rb', line 6 def self.split(secret, t0=2, n0=3, t: t0, n: n0, threshold: t, shares: n, w: nil, s: nil, x: false, token: w, level: s, hexmode: x) pwds = nil command = "ssss-split -Q -t #{threshold} -n #{shares}" command << " -w #{token}" if token command << " -s #{level}" if level command << " -x" if hexmode Open3.popen3(command) do |stdin, stdout, stderr| stdin.puts secret stdin.close pwds = stdout.read.split("\n") end return pwds end |