New multiprecision integer arithmetic suite.
[u/mdw/catacomb] / tests / mp
CommitLineData
d3409d5e 1# Test vectors for MP functions
2#
3# $Id: mp,v 1.1 1999/11/17 18:02:17 mdw Exp $
4
5add {
6 5 4 9; 5 -4 1; -5 4 -1; -5 -4 -9;
7 0xffffffff 1 0x100000000;
8}
9
10sub {
11 5 4 1; 5 -4 9; -5 4 -9; -5 -4 -1;
12 4 5 -1; 4 -5 9; -4 5 -9; -4 -5 1;
13}
14
15mul {
16 5 4 20; -5 4 -20; 5 -4 -20; -5 -4 20;
17 0x10000 0x10000 0x100000000;
18}
19
20div {
21 9 4 2 1; -9 4 -3 3; 9 -4 -3 -3; -9 -4 2 -1;
22}
23
24gcd {
25 16 12 4 -2 3;
26 12 16 4 -1 1;
27 693 609 21 -181 206;
28 4398082908043 90980984098081324 1 -32483863573352089 1570292150447;
29
30 829561629303257626084392170900075 32498098450983560651904114638965
31 5 -22841190347053190672253237276815 583054885752979049202923618992482;
32
33 5509672937670943767152343650729669537671508
34 398326674296699796695672966992514673531
35 17
36 -191606556147997561067126486929677861359
37 2650310725368604614586643627755316700713319;
38
39 324098408098290809832490802984098208098324
40 23430980840982340982098409823089098443
41 1
42 -4158709420138833210339208344965073815
43 57523460582278135926717203882531035926727;
44
45 # --- RSA test ---
46 #
47 # The first number is (p - 1)(q - 1) from `mpmont'. The second is a
48 # random number (it's actually prime, but that doesn't matter) which I
49 # can use as an RSA encryption exponent. The last is the partner
50 # decryption exponent, produced using the extended GCD algorithm.
51
52 665251164384574309450646977867043764321191240895546832784045453360
53 5945908509680983480596809586040589085680968709809890671
54 1
55 -4601007896041464028712478963832994007038251361995647370
56 514778499400157641662814932021958856708417966520837469125919104431;
57}