Giter Club home page Giter Club logo

Comments (9)

cmpute avatar cmpute commented on August 30, 2024 4

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.

cuviper avatar cuviper commented on August 30, 2024 1

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.

cuviper avatar cuviper commented on August 30, 2024

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.

vimmerru avatar vimmerru commented on August 30, 2024

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.

vimmerru avatar vimmerru commented on August 30, 2024

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.

cuviper avatar cuviper commented on August 30, 2024

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.

vimmerru avatar vimmerru commented on August 30, 2024

Thanks for this work. I will check on my side this week.

from num-bigint.

vks avatar vks commented on August 30, 2024

If you are ok with using non-Rust code, you could try rug or rust-gmp.

from num-bigint.

dignifiedquire avatar dignifiedquire commented on August 30, 2024

I have done some work on this, you can find more details about it here: #33 (comment)

from num-bigint.

Related Issues (20)

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.