Skip to content

Commit

Permalink
Merge branch 'main' into feature/NOT-gadget
Browse files Browse the repository at this point in the history
  • Loading branch information
ymekuria committed Nov 2, 2023
2 parents cfb9bb7 + 49c3f0f commit 22af158
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crypto/finite_field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,5 +197,12 @@ function createField(p: bigint, t: bigint, twoadicRoot: bigint) {
}
return BigInt('0b' + binary.reverse().join(''));
},
leftShift(x: bigint, bits: number, maxBitSize: number = 64) {
let shifted = x << BigInt(bits);
return shifted & ((1n << BigInt(maxBitSize)) - 1n);
},
rightShift(x: bigint, bits: number) {
return x >> BigInt(bits);
},
};
}

0 comments on commit 22af158

Please sign in to comment.