Code Monkey home page Code Monkey logo

agora-glass_pumpkin's Introduction

Hyperledger Labs

Hyperledger Labs provides a space (i.e., GitHub repos) where work can easily be started without the creation of a project. Please refer to the Hyperledger Labs wiki page for additional information.

Process to propose a new lab

  1. Fork the hyperledger-labs.github.io repository.

  2. Fill out the Proposal Template and save it into the labs subdirectory under the name of your lab, such as labs/mynewlab.md. It is expected that your lab repository will have the same name so keep that in mind.

  3. In the Proposal Template, there is an entry for sponsor(s). Although not required, proposers are encouraged to seek a sponsor who can help them create ties with the rest of the Hyperledger community and ensure that the proposal is cogent and novel (in conception, proposed execution, or interested community).

    To find sponsors:

    1. use your connections to existing projects and ask maintainers,
    2. find working groups or projects with affinities to the proposed lab and pitch the project (good to have the template already filled out) in associated channels and/or mailing lists. The WG chairs emails, the maintainers contacts etc can be found on the wiki or github. Make personal appeals if you can. Every repository contains a MAINTAINERS file that lists the current maintainers with their contact information and you can reach them all by posting to the Maintainers list.
  4. Commit your changes with proper sign-off. This means that your commit log message must contain a line that looks like the following one, with your actual name and email address:

     Signed-off-by: John Doe <[email protected]>
    

    Adding the -s flag to your git commit command will add that line automatically. You can also add it manually as part of your commit log message or add it afterwards with git commit --amend -s.

  5. Submit a Pull Request.

The labs stewards will then review your proposal. Like sponsors, stewards do not have a responsibility beyond this; ongoing work like contributing code or reviews is not tied to their role as stewards. In reviewing the proposal, the stewards make sure that the proposal is cogent and novel (in conception, proposed execution, or interested community).

IMPORTANT: It is up to the proposer to ensure that any comments or requested changes by the lab stewards are addressed. Failure to do so may delay the approval of your proposal.

Bringing in an existing repository

By default the Lab stewards will create a new repository for you to start from but if you have an existing github repo you would like to bring to your proposed lab you have the option to request for that repo to be reused instead. This is however only possible if every commit in your existing repo is signed-off so there is no DCO related issues. If that is not the case, you have two options:

  1. bring your code by squashing all of your commits into a single first commit made against your new lab repo with your sign-off.

  2. amend the commit history to include DCO sign-off for each of the commits. The Hyperledger Indy community has documented steps to fix DCO on previous commits. Also, the Fix DCO Guide from src-d contains some different steps you can take.

IMPORTANT: Regardless of which option you use, please be sure that the past committers to your project agree to the DCO.

Archiving

Stewards are responsible for curating the set of labs, archiving (see below) those that become dormant or unresponsive for an extended period (3+ months), or are explicitly deemed by the committers to be deprecated/obsoleted.

Deprecated, obsoleted, or dormant labs (as defined above) will be marked as "archived" in GitHub; that signifies that the lab is no longer maintained. Archived labs are read-only, and they can be moved back out of the archives, if there is interest in reviving them.

License requirement

All Hyperledger software must be made available under an Apache 2.0 license. This applies to Labs. Please, make sure to license all incoming code and new code accordingly, and ensure that all commits are made with proper sign-off so that no DCO related issue is introduced.

Code of Conduct

All Hyperledger community members must adhere to the Code of Conduct.

agora-glass_pumpkin's People

Contributors

andrewwhitehead avatar mikelodder7 avatar ryjones avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

agora-glass_pumpkin's Issues

Unnecessary allocations in miller_rabin

I'm trying to adapt this crate for no_std (and for use with crypto_bigint), and I'm wondering why in the miller_rabin test do we need to allocate all bases at once, instead of generating them on the fly with iterators?

Intermittent 'attempt to subtract with overflow' panic

https://github.com/mikelodder7/glass_pumpkin/blob/412a51b8235187c980a0194b6eae44ff02ac89aa/src/common.rs#L176

Encountered an intermittent panic when calling glass_pumpkin::prime::strong_check():

thread 'main' panicked at 'attempt to subtract with overflow', /home/jnichols/.cargo/registry/src/github.com-1ecc6299db9ec823/glass_pumpkin-0.5.0/src/common.rs:176:25

trials may be zero, so the subtraction in the range definition can underflow.

If I understand the Miller Rabin algorithm properly, then I think a larger issue lies in rewrite():

https://github.com/mikelodder7/glass_pumpkin/blob/412a51b8235187c980a0194b6eae44ff02ac89aa/src/common.rs#L192-L202

I think rewrite() is trying to find r (aka trials) and d from the following line in the algorithm, as given on wikipedia:

write n as 2^{r}·d + 1 with d odd (by factoring out powers of 2 from n − 1)

However the current rewrite() function simply returns trials = 0 and d = candidate - 1 (making d always positive) whenever candidate is odd.

Possible error in MR test

The decomposition function for MR, rewrite() reads:

fn rewrite(candidate: &BigUint) -> (u64, BigUint) {
    let mut d = candidate - 1_u32;
    let mut trials = 0;

    while d.is_odd() {
        d >>= 1;
        trials += 1;
    }

    (trials, d)
}

It seems that it should be while d.is_even() instead (otherwise it always returns trials = 0, and perhaps that's why miller_rabin() sets trials to at least 5), but if I make that change is_prime_tests() fails. The strange thing is that those tests fail because the MR test fails, but the Lucas test still passes - but that may be an effect of #16? I am not sure how those test numbers were obtained, perhaps you can shed some light on it.

Redundant primality test in gen_safe_prime

The function to generate a safe prime, gen_safe_prime, performs another primality test on the random prime that was just generated.

Specifically, in gen_safe_prime, gen_prime returns a probable prime, but the next check _is_safe_prime(...) && lucas(...) tests again that candidate is a prime. This is already done in gen_prime, so we now only need to check if (candidate - 1)/2 is also prime.

Why large minimum bit length?

I am using glass_pumpkin for a teaching demo, and really just want 32-bit primes. Is there some reason for the restriction to 128 bits or more? Sure would be great to remove it for my use case.

Lucas Test is broken

Lucas test (and by extension the Baillie-PSW test used in "strong_check") flags some primes as composites. A cursory search found no composites that passed (given the rarity of even 2-SPRPs beyond 2^64 this is fully expected) ,however the aforementioned behavior is sufficient to demonstrate that the test does not perform as predicted and may pass more composites than a correct implementation. Below is one example.

N
18446744073710004191
Claim
true

Witness
8300848561679324618

Factorization of n-1
2, 5, 1844674407371000419

Performance of safe prime generation order of magnitude worse than openssl

First, thanks for the nice library! I'm using it to implement a threshold variant of paillier (code is here https://github.com/robinhundt/pht-crypto but still under construction).
I've noticed that my key generation takes a considerable amount of time due to the generation of safe primes being slow (taking minutes for safe primes of size 2048 bits on my machine). I've noticed that openssl is considerably faster in generating safe primes (using https://docs.rs/openssl/0.10.36/openssl/bn/struct.BigNumRef.html#method.generate_prime ).
If there is interest, I could send a PR with benchmarks comparing the openssl implementation and this one :) Maybe there are some easy improvements which could bring the performance closer to the one offered by openssl.

Can not get prime if length<16

if length<16, check prime will also pass that r % p == 0 if r==p. The biggest prime of first 2048 prime is 16bit long.

This problem exist in almost every prime generation crates

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.