Comments (9)
Although it's an old question, but I'm building a crate (num-prime
) to support various algorithms for prime generation, primality checks and integer factorization with big integer implementation (right now num-bigint
, in future maybe also support rug
). Just list it here in case anyone is interested.
from num-bigint.
I'm not confident enough to answer that... Tell you what, I'll see if I can clean that up as an example program, at least, and we can go from there.
from num-bigint.
Nothing in the crate, and I'm not aware of anything published elsewhere. I do have a generic Miller-Rabin implementation that I use for Project Euler problems, but I'm not sure it's good enough to share. :)
from num-bigint.
Does it look fast enough for RSA-like crypto needs? For now i use OpenSSL, but consider switching to some rust-native solution to simplify cross-platforms builds and deployment.
from num-bigint.
If you interested in we can benchmark it over OpenSSL together. My BN wrapper over OpenSSL is placed here https://github.com/hyperledger/indy-crypto/blob/master/libindy-crypto/src/bn/openssl.rs
I am interesting in performance of calls:
pub fn generate_prime(size: usize) -> Result<BigNumber, IndyCryptoError> {
let mut bn = BigNumber::new()?;
BigNumRef::generate_prime(&mut bn.openssl_bn, size as i32, false, None, None)?;
Ok(bn)
}
pub fn generate_safe_prime(size: usize) -> Result<BigNumber, IndyCryptoError> {
let mut bn = BigNumber::new()?;
BigNumRef::generate_prime(&mut bn.openssl_bn, (size + 1) as i32, true, None, None)?;
Ok(bn)
}
from num-bigint.
See #33 -- but I'll save you some suspense, it's definitely not as fast as OpenSSL. Make sure you at least run it with optimization though, e.g. cargo run --release --features rand --example primes
.
from num-bigint.
Thanks for this work. I will check on my side this week.
from num-bigint.
If you are ok with using non-Rust code, you could try rug
or rust-gmp
.
from num-bigint.
I have done some work on this, you can find more details about it here: #33 (comment)
from num-bigint.
Related Issues (20)
- Is there a reason that `Copy` isn't implemented for `BigInt` and `BigUint` HOT 3
- `test_convert_f32` test failed on `i686-pc-windows-*` target HOT 8
- Whether to enable simd support? HOT 2
- Absolute value HOT 6
- Compiling Bigint Without Cargo HOT 1
- Debug output doesn't honor formatting specifier x HOT 1
- to_str_radix produces odd number of digits HOT 2
- Build script could be replaced with const fn HOT 4
- Incorrect handling of "_" chars in decimal part of number HOT 1
- From f64 HOT 2
- BigInt absolute value as a BigUint value HOT 2
- Add is_negative and is_non_negative HOT 1
- BigInt::parse_bytes converting a string with '_' as bigint with base 36 which isn't expected. HOT 2
- Feature Request: Ref type for {BigInt|BigUint} HOT 2
- Ability to create const BigUint etc. HOT 2
- Add powi method for `Sign` enum HOT 1
- re-export num_traits HOT 1
- Possible Incompleteness HOT 2
- Mixed-algorithm GCD (potential optimization) HOT 1
- x86_64-unknown-linux-gnux32 no longer works with 0.4.5 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from num-bigint.