Skip to content

Commit

Permalink
fmt: Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
pmerkleplant committed May 4, 2024
1 parent bc6c66c commit e6dffc1
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/onchain/common/Nonce.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ access to a source of high-quality randomness.
* @custom:repository github.com/verklegarden/crysol
*/
library Nonce {

/// @dev Generates a deterministic nonce ∊ [1, `fieldModulus`) from secret
/// key `sk` and message digest `digest`.
///
Expand Down Expand Up @@ -123,17 +122,15 @@ library Nonce {
assert(uint(digest) < fieldModulus);

// Initialize v and k as specified.
bytes32 v =
bytes32(0x0101010101010101010101010101010101010101010101010101010101010101);
bytes32 k =
bytes32(0x0000000000000000000000000000000000000000000000000000000000000000);
bytes32 v = bytes32(
0x0101010101010101010101010101010101010101010101010101010101010101
);
bytes32 k = bytes32(
0x0000000000000000000000000000000000000000000000000000000000000000
);

// Let k = H(v || 0x00 || sk || digest)
k = keccak256(
abi.encodePacked(
v, bytes1(0x00), sk, digest
)
);
k = keccak256(abi.encodePacked(v, bytes1(0x00), sk, digest));
// Let v = H(v) TODO: Can be precomputed?
v = keccak256(abi.encodePacked(v));
// Let k = H(v || 0x01 || sk || digest)
Expand Down

0 comments on commit e6dffc1

Please sign in to comment.