Debugging headache

phd student is having big headache figuring out why a simple operation 2P – P is not equal to P. going to have a holiday without bringing the laptop but still have this problem unsolved… arrrrrrhhhh!!!

        data->e[NUMWORD] = 0x6000000;
        data->e[NUMWORD-1] = 0x0;
        data->e[NUMWORD-2] = 0x0;
        data->e[NUMWORD-3] = 0x0;
        data->e[NUMWORD-4] = 0x6f0a0000;
        data->e[NUMWORD-5] = 0x68616c6c;

        print_field("data test = ", data);

        //t is for storing the k
        null(t);
        t->e[NUMWORD] = 2;   //k  = 2, Q = 2*P
        print_field("t = ", t);
        printf("setting up curves\n\n");
        set_curve(curve);
        print_curve("the curve after setting up: ", curve);

        poly_embed(data, curve, 1, 0, p);
        printf("data after embedded to the curve: \n");
        print_point("p = ", p);

        printf("after point multiplication: \n");
        poly_elptic_mul(t, p, r, curve);
        print_point("r = ", r);

        null(t);
        t->e[NUMWORD] = 1;  
        print_field("t = ", t);
        printf("get the point back: \n");
        poly_elptic_mul(t, p, q, curve);
        print_point("q = ", q); 
        poly_esub(r, q, s, curve);
        print_point("s = ", s);


poly_prime =
8 0 0 0 0 c9
NUMWORD = 5
data test =
68616c6c 6f0a0000 0 0 0 6000000
t =
0 0 0 0 0 2
setting up curves

the curve after setting up:
form: 1
a2: 2 0 0 0 0 0
a6: 1 0 0 0 0 0

counter = 0
inc = 1
data after embedded to the curve:
p =
x: 68616c6c 6f0a0000 0 0 0 6000000
y: 2 7fcb6ca7 1bdfc7ca 17329198 9524f59c ec7659ad
after point multiplication:
r =
x: 68616c6c 90451c30 58c15ae5 9afb81ac 98bea99d 567b1a47
y: 2 ddf40f6e adf0823c 6931b5e1 be2b181a 4cafded5
t =
0 0 0 0 0 1
get the point back:
q =
x: 68616c6c 6f0a0000 0 0 0 6000000
y: 2 7fcb6ca7 1bdfc7ca 17329198 9524f59c ec7659ad
s =
x: 1 cf0b01a6 9e358040 b87f8a0d 56118a0a 50644166
y: 0 5a4b1583 616c21cb 3ecc2d26 d99e32df ac36450

Advertisements