New multiprecision integer arithmetic suite.
[u/mdw/catacomb] / tests / mpmont
1 # Test vectors for Montgomery reduction
2 #
3 # $Id: mpmont,v 1.1 1999/11/17 18:02:17 mdw Exp $
4
5 create {
6 340809809850981098423498794792349 # m
7 266454859 # -m^{-1} mod b
8 130655606683780235388773757767708 # R mod m
9 237786678640282040194246459306177; # R^2 mod m
10 }
11
12 mul {
13 43289823545
14 234324324
15 6456542564
16 10807149256;
17 }
18
19 exp {
20 4325987397987458979875737589783
21 435365332435654643667
22 8745435676786567758678547
23 2439674515119108242643169132064;
24
25 # --- Quick RSA test ---
26
27 905609324890967090294090970600361 # This is p
28 3
29 905609324890967090294090970600360 # This is (p - 1)
30 1; # Fermat test: p is prime
31
32 734589569806680985408670989082927 # This is q
33 5
34 734589569806680985408670989082926 # And this is (q - 1)
35 1; # Fermat again: q is prime
36
37 # --- Encrypt a message ---
38 #
39 # The public and private exponents are from the GCD test. The message
40 # is just obvious. The modulus is the product of the two primes above.
41
42 665251164384574309450646977867045404520085938543622535546005136647
43 123456789012345678901234567890123456789012345678901234567890
44 5945908509680983480596809586040589085680968709809890671
45 25906467774034212974484417859588980567136610347807401817990462701;
46
47 # --- And decrypt it again ---
48
49 665251164384574309450646977867045404520085938543622535546005136647
50 25906467774034212974484417859588980567136610347807401817990462701
51 514778499400157641662814932021958856708417966520837469125919104431
52 123456789012345678901234567890123456789012345678901234567890;
53 }