lambdaclass / lambdaworks

lambdaworks offers implementations for both SNARKs and STARKs provers, along with the flexibility to leverage their individual components for constructing customized SNARKs.
https://lambdaclass.github.io/lambdaworks/
Apache License 2.0
625 stars 140 forks source link

Add Rescue Prime Optimized #930

Closed jotabulacios closed 2 weeks ago

jotabulacios commented 1 month ago

Add Rescue Prime Optimized

Description

This PR adds the Rescue Prime Optimized hash function. The implementation offers three types of MDS transformations: Matrix Multiplication, Karatsuba, and NTT

Example:

let rescue = RescuePrimeOptimized::new(SecurityLevel::Sec128, MdsMethod::Ntt).unwrap();
let input = b"Hello there";
let hash_output = rescue.hash(input);

In this case 128 is the security level, the other available level is 160 To use other MdsMethod simply change MatrixMultiplication for Karatsuba or Ntt

Type of change

codecov-commenter commented 1 month ago

Codecov Report

Attention: Patch coverage is 92.80156% with 37 lines in your changes missing coverage. Please review.

Project coverage is 71.97%. Comparing base (8dfddac) to head (ea8267d).

Files with missing lines Patch % Lines
crypto/src/hash/rescue_prime/utils.rs 58.82% 28 Missing :warning:
...to/src/hash/rescue_prime/rescue_prime_optimized.rs 98.07% 8 Missing :warning:
crypto/src/hash/rescue_prime/parameters.rs 96.66% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #930 +/- ## ========================================== + Coverage 71.62% 71.97% +0.35% ========================================== Files 149 152 +3 Lines 32560 33074 +514 ========================================== + Hits 23321 23805 +484 - Misses 9239 9269 +30 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.