Skip to content

Commit 46a6eb1

Browse files
authored
Merge pull request #2 from noir-lang/mv/update-to-u32-num-gen
fix: Switch to u32 numeric generics and update to 0.3.0 bignum
2 parents b1c88ef + 86655b1 commit 46a6eb1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Nargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ authors = [""]
55
compiler_version = ">=0.32.0"
66

77
[dependencies]
8-
bignum = {tag = "v0.2.1", git = "https://github.com/noir-lang/noir-bignum"}
8+
bignum = {tag = "v0.3.0", git = "https://github.com/noir-lang/noir-bignum"}

src/lib.nr

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ use dep::bignum::utils::arrayX::ArrayX;
88
use dep::bignum::fields::Params2048;
99
use dep::bignum::fields::Params1024;
1010

11-
struct RSA<BN, BNInstance, let NumBytes: u64>{}
11+
struct RSA<BN, BNInstance, let NumBytes: u32>{}
1212

1313
/**
1414
* @brief Compare a recovered byte hash from an RSA signature to the original message hash
1515
* @details Taken from https://github.com/richardliang/noir-rsa
1616
**/
17-
fn compare_signature_sha256<let N: u64>(padded_sha256_hash: [u8; N], msg_hash: [u8; 32]) -> bool {
17+
fn compare_signature_sha256<let N: u32>(padded_sha256_hash: [u8; N], msg_hash: [u8; 32]) -> bool {
1818
// Get length of sig (e.g. 1048 = 128 bytes, 2048 = 256 bytes)
1919
// NOTE: Assume MAX_BYTES < 2^32 bit number. MAX_BYTES of 259 > 2^8 bits so need to cast it to u32
2020

@@ -51,7 +51,7 @@ fn compare_signature_sha256<let N: u64>(padded_sha256_hash: [u8; N], msg_hash: [
5151

5252
true
5353
}
54-
impl<BN, BNInstance, let NumBytes: u64> RSA<BN, BNInstance, NumBytes> where BN: BigNumTrait, BNInstance: BigNumInstanceTrait<BN> {
54+
impl<BN, BNInstance, let NumBytes: u32> RSA<BN, BNInstance, NumBytes> where BN: BigNumTrait, BNInstance: BigNumInstanceTrait<BN> {
5555
/**
5656
* @brief Verify an RSA signature generated via the pkcs1v15 signature scheme.
5757
* @details The fourth function parameter is required to define the value of `NBytes`

0 commit comments

Comments
 (0)