Separate out to_montgomery and from_montgomery for bignum tests
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
This commit is contained in:
parent
ecda186893
commit
c240600f24
3 changed files with 11 additions and 6 deletions
|
@ -251,6 +251,12 @@ class ModOperationCommon(OperationCommon):
|
|||
# provides earlier/more robust input validation.
|
||||
self.int_n = hex_to_int(val_n)
|
||||
|
||||
def to_montgomery(self, val) -> int:
|
||||
return (val * self.r) % self.int_n
|
||||
|
||||
def from_montgomery(self, val) -> int:
|
||||
return (val * self.r_inv) % self.int_n
|
||||
|
||||
@property
|
||||
def boundary(self) -> int:
|
||||
return self.int_n
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue