cangrepp

Some cryptographic attacks
Log | Files | Refs | README

commit 97570040f0f6a08e47108aa21cd9d493893d603d
parent 35545c34c18ca8a20fd573ce379d720f9d8190c9
Author: olikru <olikru@tkruger.se>
Date:   Tue, 16 Apr 2024 12:00:14 +0200

added a unit test for wiener

Diffstat:
Mtest_angrepp.c | 23+++++++++++++++++++++++
1 file changed, 23 insertions(+), 0 deletions(-)

diff --git a/test_angrepp.c b/test_angrepp.c @@ -6,6 +6,7 @@ #include "cyclefind.h" #include "pierre.h" +#include "wiener.h" static uint64_t test_f(uint64_t x) @@ -50,12 +51,34 @@ test_pierre_factor(void) fmpz_clear(r); } +static void +test_wiener_factor_small_d(void) +{ + fmpz_t N, e, res; + fmpz_init(N); + fmpz_init(e); + fmpz_init(res); + + fmpz_set_str(N, "32193226917433121", 10); + fmpz_set_str(e, "8403467516040173", 10); + + wiener_factor_small_d(res, e, N); + + assert(fmpz_divisible(N, res)); + assert(fmpz_cmp_ui(res, 1) > 0); + + fmpz_clear(N); + fmpz_clear(e); + fmpz_clear(res); +} + int main(void) { test_cyclefind_floyd(); test_cyclefind_brent(); test_pierre_factor(); + test_wiener_factor_small_d(); printf("test ok\n"); }