zcdziura / pumpkin Goto Github PK
View Code? Open in Web Editor NEWA random number generator for generating large prime numbers, suitable for cryptography.
Home Page: https://zcdziura.github.io/pumpkin/pumpkin
License: MIT License
A random number generator for generating large prime numbers, suitable for cryptography.
Home Page: https://zcdziura.github.io/pumpkin/pumpkin
License: MIT License
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.
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>
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,
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
.
Back to the future was yesterday but Halloween 2015 is still coming in 10 days' time :)
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.
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,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.