support for setting your own secret using set_fixed_secret()
[secretsharing.git] / README
blob48671e628a0b694ebb57a5a06d867056136fcf88
1 == Description
2    A libary for sharing secrets in an information-theoretically secure way.
3    It uses Shamir's secret sharing to enable sharing a (random) secret between
4    n persons where k <= n persons are enough to recover the secret. k-1 secret
5    share holders learn nothing about the secret when they combine their shares.
7    This library is based on the OpenXPKI::Crypto::Secret::Split Perl module used
8    in the open source PKI software OpenXPKI, which was written by Alexander Klink
9    for the OpenXPKI project in 2006.
11 == Prerequisites
12    This package requires Ruby 1.8 or later.
14 == Installation instructions
15    rake test (optional)
16    rake install (non-gem) or rake install_gem (gem)
18 == Synopsis
19    require 'secretsharing'
21    # create an object for 3 out of 5 secret sharing
22    s = SecretSharing::Shamir.new(5,3)
24    # create a random secret (returns the secret)
25    s.create_random_secret()
27    # show secret
28    puts s.secret
30    # show password representation of secret (Base64)
31    puts s.secret_password
33    # show shares
34    s.shares.each { |share| puts share }
36    # recover secret from shares
38    s2 = SecretSharing::Shamir.new(3)
39    # accepts SecretSharing::Shamir::Share objects or
40    # string representations thereof
41    s2 << s.shares[0]
42    s2 << s.shares[2]
43    s2 << s.shares[4]
44    puts s2.secret
46 == Copyright
47    (c) 2010-2011 Alexander Klink
49 == License
50    Licensed under the Apache License, Version 2.0 (the "License");
51    you may not use this file except in compliance with the License.
52    You may obtain a copy of the License at
54    http://www.apache.org/licenses/LICENSE-2.0
56 == Warranty
57    Unless required by applicable law or agreed to in writing, software
58    distributed under the License is distributed on an "AS IS" BASIS,
59    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
60    See the License for the specific language governing permissions and
61    limitations under the License.
63 == Author
64    Alexander Klink
65    secretsharing@alech.de
66    http://www.alech.de
67    @alech on Twitter