GithubHelp home page GithubHelp logo

zcdziura / pumpkin Goto Github PK

View Code? Open in Web Editor NEW
51.0 51.0 8.0 1.23 MB

A random number generator for generating large prime numbers, suitable for cryptography.

Home Page: https://zcdziura.github.io/pumpkin/pumpkin

License: MIT License

Rust 100.00%

pumpkin's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

pumpkin's Issues

Safe Prime generation and other types

Just wondering your thoughtson the implementation of safe prime generation routines and whether this is within this crates scope?

As a bit of background, safe primes are primes of the form q = 2p+1 where p is also prime. They do appear as requirements in some cryptographic systems (e.g. Threshold Damgård–Jurik cryptosystem) and as such do have practical usage.

One consideration is the execution time required, as these primes are much less common, the runtime grows at a much worse rate. GMP is in the minutes for a 2048-bit safe prime from memory, so I can imagine this would need to be factored in here.

Error in ramp library

When using pumpkin 2.01 in a project with rustc 1.39.0-nightly (521d78407 2019-08-25) and the following dependencies:

[dependencies]
pumpkin = "2.0.1"
modinverse = "0.1.1"
num-integer = "0.1.41"
ramp = "0.5.2"

It downloads ramp v0.3.13 and gets the following errors:

Compiling ramp v0.3.13
error[E0658]: use of unstable library feature 'raw_vec_internals': implementation detail
--> /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/ramp-0.3.13/src/int.rs:43:5
|
43 | use alloc::raw_vec::RawVec;
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(raw_vec_internals)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'raw_vec_internals': implementation detail
--> /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/ramp-0.3.13/src/int.rs:152:36
|
152 | fn with_raw_vec<F: FnOnce(&mut RawVec)>(&mut self, f: F) {
| ^^^^^^^^^^^^
|
= help: add #![feature(raw_vec_internals)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'raw_vec_internals': implementation detail
--> /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/ramp-0.3.13/src/int.rs:155:27
|
155 | let mut vec = RawVec::from_raw_parts(self.ptr.as_mut(), old_cap);
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(raw_vec_internals)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'raw_vec_internals': implementation detail
--> /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/ramp-0.3.13/src/int.rs:939:22
|
939 | drop(RawVec::from_raw_parts(self.ptr.as_mut(),
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(raw_vec_internals)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'raw_vec_internals': implementation detail
--> /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/ramp-0.3.13/src/int.rs:163:40
|
163 | self.ptr = Unique::new(vec.ptr()).unwrap();
| ^^^
|
= help: add #![feature(raw_vec_internals)] to the crate attributes to enable

error[E0599]: no method named cap found for type alloc::raw_vec::RawVec<ll::limb::Limb> in the current scope
--> /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/ramp-0.3.13/src/int.rs:164:31
|
164 | let new_cap = vec.cap();
| ^^^ private field, not a method

error[E0658]: use of unstable library feature 'raw_vec_internals': implementation detail
--> /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/ramp-0.3.13/src/int.rs:186:36
|
186 | ret.with_raw_vec(|v| v.reserve_exact(0, cap as usize))
| ^^^^^^^^^^^^^
|
= help: add #![feature(raw_vec_internals)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'raw_vec_internals': implementation detail
--> /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/ramp-0.3.13/src/int.rs:275:15
|
275 | v.shrink_to_fit(size);
| ^^^^^^^^^^^^^
|
= help: add #![feature(raw_vec_internals)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'raw_vec_internals': implementation detail
--> /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/ramp-0.3.13/src/int.rs:760:19
|
760 | v.reserve_exact(old_cap, cap as usize - old_cap)
| ^^^^^^^^^^^^^
|
= help: add #![feature(raw_vec_internals)] to the crate attributes to enable

error: aborting due to 9 previous errors

This seems odd as ramp = "0.5" is the dependency in this repo. Maybe this is an issue with the cargo package manager>

Unable to compile Pumpkin / Ramp: `rustc 1.26.0-nightly`

The README specify pumpkin = "2.0.*" where https://crates.io/crates/pumpkin specify pumpkin = "1.0.*".
When using pumpkin = "1.0.*" (2.0.* is not available) with rustc 1.26.0-nightly (55c984ee5 2018-03-16) I am getting lot of compilation errors from ramp. For example:

error[E0658]: use of unstable library feature 'ptr_internals': use NonNull instead and consider PhantomData<T> (if you also use #[may_dangle]), Send, and/or Sync (see issue #0)
    --> /Users/Gary/.cargo/registry/src/github.com-1ecc6299db9ec823/ramp-0.2.5/src/int.rs:3416:27
     |
3416 |             ptr: unsafe { Unique::new(alloc::heap::EMPTY as *mut Limb) },
     |                           ^^^^^^^^^^^
     |
     = help: add #![feature(ptr_internals)] to the crate attributes to enable

How can we get pumpkin to compile?

Thanks,

Rather than panicking when an error occurs, all functions should return a Result enum

Good library design dictates that the library itself should never panic. Instead, it should return meaningful error messages, allowing the user the control over what should happen to their program. Currently, should the user give bad inputs, the various prime generation functions panic!. Instead, they should return some type of Result.

Dates dates

Back to the future was yesterday but Halloween 2015 is still coming in 10 days' time :)

Custom Derive generated ops are too restrictive

Currently, the code generated by the custom_derive! statements will result in Prime types being returned. This doesn't make sense for the most part, i.e a prime + 1 is not guaranteed to be prime.

Expected behaviour would be returning ramp Int values instead.

Doesn't seem like custom_derive supports specifying output types which makes this a little bit harder to do.

Pumpkin only available in Nightly

Hi,
Is there an ongoing process for integrating pumpkin as part of the stable distribution channel?
What is the reason of the availability only in Nightly?

Thanks,

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.