Merge pull request #6941 from gabor-mezei-arm/6375_quasi-reduction_function
Add function to fix quasi-reduction
This commit is contained in:
commit
470f10cfc5
5 changed files with 144 additions and 1 deletions
|
@ -51,6 +51,37 @@ class BignumModRawSub(bignum_common.ModOperationCommon,
|
|||
result = (self.int_a - self.int_b) % self.int_n
|
||||
return [self.format_result(result)]
|
||||
|
||||
class BignumModRawFixQuasiReduction(bignum_common.ModOperationCommon,
|
||||
BignumModRawTarget):
|
||||
"""Test cases for ecp quasi_reduction()."""
|
||||
symbol = "-"
|
||||
test_function = "mpi_mod_raw_fix_quasi_reduction"
|
||||
test_name = "fix_quasi_reduction"
|
||||
input_style = "fixed"
|
||||
arity = 1
|
||||
|
||||
# Extend the default values with n < x < 2n
|
||||
input_values = bignum_common.ModOperationCommon.input_values + [
|
||||
"73",
|
||||
|
||||
# First number generated by random.getrandbits(1024) - seed(3,2)
|
||||
"ea7b5bf55eb561a4216363698b529b4a97b750923ceb3ffd",
|
||||
|
||||
# First number generated by random.getrandbits(1024) - seed(1,2)
|
||||
("cd447e35b8b6d8fe442e3d437204e52db2221a58008a05a6c4647159c324c985"
|
||||
"9b810e766ec9d28663ca828dd5f4b3b2e4b06ce60741c7a87ce42c8218072e8c"
|
||||
"35bf992dc9e9c616612e7696a6cecc1b78e510617311d8a3c2ce6f447ed4d57b"
|
||||
"1e2feb89414c343c1027c4d1c386bbc4cd613e30d8f16adf91b7584a2265b1f5")
|
||||
] # type: List[str]
|
||||
|
||||
def result(self) -> List[str]:
|
||||
result = self.int_a % self.int_n
|
||||
return [self.format_result(result)]
|
||||
|
||||
@property
|
||||
def is_valid(self) -> bool:
|
||||
return bool(self.int_a < 2 * self.int_n)
|
||||
|
||||
class BignumModRawMul(bignum_common.ModOperationCommon,
|
||||
BignumModRawTarget):
|
||||
"""Test cases for bignum mpi_mod_raw_mul()."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue