Coder Social home page Coder Social logo

grempe / secretsharing Goto Github PK

View Code? Open in Web Editor NEW
21.0 21.0 3.0 195 KB

NO LONGER MAINTAINED, please see important news in README.md. Shamir's Secret Sharing is an algorithm in cryptography. 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. Holders of a share gain no knowledge of the larger secret.

Home Page: https://github.com/grempe/secretsharing

License: Apache License 2.0

Ruby 100.00%

secretsharing's Introduction

Hi there, I'm Glenn - aka @grempe ๐Ÿ‘‹

Twitter Follow

I'm a Husband, Father, Developer, and the Founder & CEO of Truestamp (on GitHub @truestamp)!!

  • ๐ŸŒฑ Iโ€™m currently growing Truestamp ๐Ÿคฃ
  • ๐Ÿ‘ฏ Iโ€™m focused on the intersection of Privacy, Security, Cryptography, and Integrity
  • ๐Ÿฅ… Goals: Help my customers verify the integrity of their most important data
  • โšก Fun fact: My vehicle license plate has a cryptography reference. I think it confuses most who see it

Connect with me


GitHub Stats


Truestamp's GitHub stats

Top Langs

secretsharing's People

Contributors

grempe avatar ntalbott avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

secretsharing's Issues

Published to Rubygems.

I'm very impressed with this implementation and looking forward to using it my own project. I notice that you have contributed some great code clean up to the originally published gem.

Will these changes be contributed back to a new version of the published 'secretsharing' gem or will they remain on your fork? I'm just trying to figure out the best way to get your latest code into my project.

Thanks!
Andy

Design Review - Abstract out Cryptographic Primatives

This is refactoring idea I've been kicking around. I would be happy to
implement this if I could get your thoughts before I take the plunge.

Right now the implementation is coupled tightly with OpenSSL. This this makes
sense for most users but it does not seem to be a core concern of the
SSS Algorithm.

Specifically, I do not us OpenSSL in my project, I use DJB's NaCl. Also, maintaining
tight control over my Random Number generator, is very important to me.

I'm wondering if we can abstract away some of these more primative functions.
Something like:

module SecretSharing
  class BigNumber
    # call OpenSSL::BN from One Place
  end
end
module SecretSharing
  class RandomNumber
    # call OpenSSL Random Number Generations from One Place
  end
end

This would allow us to depend on abstraction and provide the opportunity to swap out crypto libraries, leaving OpenSSL as the smart default.

Failing to retrieve secret with some combination of 3 out of 5

This combination fails

[27] pry(main)> secret='100057108055106048110037051094112064114038050069035073097053043122033082121074107056090102067'
=> "100057108055106048110037051094112064114038050069035073097053043122033082121074107056090102067"
[28] pry(main)> s=SecretSharing::Shamir.new(5,3)
=> #<SecretSharing::Shamir:0x0000000771f820
 @k=3,
 @n=5,
 @received_shares=[],
 @secret=nil,
 @shares=[]>
[29] pry(main)> s.set_fixed_secret(secret)
=> #<OpenSSL::BN:0x0000000784c810>
[30] pry(main)> shares=s.shares.map(&:to_s)
=> ["001FF69184824D423CC4BA75B320143BB541358BC03C0DF81BC899DF25F267E3B334304E7DD81807DB5A4D",
 "00279F04A8FE67F4331423AE9B867529800816314A1B77ED518F1390073495648F2FE98411547D3E6B8A4D",
 "003A0B40BA0C9D4FCD6AF67D7D8827460B297031517EC08C011997F1EAA843EFF9CA0A88CA92EB6DAB614D",
 "004173B45B7ACED550BC932E259252A9156A5438BD665E7D42A682704D04D7385F302935CA9936294607E4D",
 "005F2F13A1DF5803EE2ED8DD2E5D7F0B627B9040D8D0EDC5CD7AC0C8B82424267AD983FFAE55E01E06BF4D"]
[31] pry(main)> r=SecretSharing::Shamir.new(3)
=> #<SecretSharing::Shamir:0x000000078f4880
 @k=3,
 @n=3,
 @received_shares=[],
 @secret=nil,
 @shares=[]>
[32] pry(main)> r<<shares[0]
=> false
[33] pry(main)> r<<shares[1]
=> false
[34] pry(main)> r<<shares[4]
OpenSSL::BNError: no inverse
from /home/assaf/.rvm/gems/ruby-2.0.0-p353/gems/secretsharing-0.3/lib/secretsharing/shamir.rb:225:in `mod_inverse'
[35] pry(main)> 

This combination succeeds

[36] pry(main)> r2=SecretSharing::Shamir.new(3)
=> #<SecretSharing::Shamir:0x00000006119dc8
 @k=3,
 @n=3,
 @received_shares=[],
 @secret=nil,
 @shares=[]>
[37] pry(main)> r2<<shares[2]
=> false
[38] pry(main)> r2<<shares[1]
=> false
[39] pry(main)> r2<<shares[0]
=> true
[40] pry(main)> r2.secret.to_s
=> "100057108055106048110037051094112064114038050069035073097053043122033082121074107056090102067"
[41] pry(main)> 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.