-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Increase maximum bit length for BigNum conversion to uint
The code changes in the `BigNum.sol` contract increase the maximum bit length allowed for converting a `BigNumber` to a `uint`. The previous limit of 256 bits has been updated to 512 bits. This change ensures that larger `BigNumbers` can be safely converted to `uint` without triggering an error. This commit message follows the established conventions in the repository.
- Loading branch information
Showing
4 changed files
with
19 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import * as bcu from 'bigint-crypto-utils'; | ||
|
||
export function getRandom(n: bigint): bigint { | ||
let r: bigint = BigInt(0); | ||
do { | ||
r = bcu.randBetween(n); | ||
} while (bcu.gcd(r, n) !== 1n); | ||
return r; | ||
} |