Is it on curve? (on prime fields)

Sample parameters (from Guide to Elliptic Curve Cryptography #262)

P-192: p = 2^192 − 2^64 − 1, a = −3, h = 1
S = 0x 3045AE6F C8422F64 ED579528 D38120EA E12196D5
r = 0x 3099D2BB BFCB2538 542DCD5F B078B6EF 5F3D6FE2 C745DE65
b = 0x 64210519 E59C80E7 0FA7E9AB 72243049 FEB8DEEC C146B9B1
n = 0x FFFFFFFF FFFFFFFF FFFFFFFF 99DEF836 146BC9B1 B4D22831

y = 0x 07192B95 FFC8DA78 631011ED 6B24CDD5 73F977A1 1E794811

The variables:

y = 174050332293622031404857552280219410364023488927386650641
b = 2455155546008943817740293915197451784769108058161191238065

Calculating in PARI:

chika$ gp
Reading GPRC: /sw/etc/gprc ...Done.

                  GP/PARI CALCULATOR Version 2.1.7 (released)
                             unknown 32-bit version
                (readline v5.0 enabled, extended help available)

                       Copyright (C) 2002 The PARI Group

PARI/GP is free software, covered by the GNU General Public License, and 
comes WITHOUT ANY WARRANTY WHATSOEVER.
beowulf:~ chika$ gp
Reading GPRC: /sw/etc/gprc ...Done.

                  GP/PARI CALCULATOR Version 2.1.7 (released)
                             unknown 32-bit version
                (readline v5.0 enabled, extended help available)

                       Copyright (C) 2002 The PARI Group

PARI/GP is free software, covered by the GNU General Public License, and 
comes WITHOUT ANY WARRANTY WHATSOEVER.

Type ? for help, \q to quit.
Type ?12 for how to get moral (and possibly technical) support.

   realprecision = 28 significant digits
   seriesprecision = 16 significant terms
   format = g0.28

parisize = 4000000, primelimit = 500000
(12:21) gp > p = 2^192-2^64-1
%1 = 6277101735386680763835789423207666416083908700390324961279
(12:22) gp > a = Mod(-3,p)
%2 = Mod(6277101735386680763835789423207666416083908700390324961276, 6277101735386680763835789423207666416083908700390324961279)
(12:22) gp > b = Mod(2455155546008943817740293915197451784769108058161191238065,p)
%3 = Mod(2455155546008943817740293915197451784769108058161191238065, 6277101735386680763835789423207666416083908700390324961279)
(12:22) gp > E = ellinit([0,0,0,a,b])
%4 = [0, 0, 0, Mod(6277101735386680763835789423207666416083908700390324961276, 6277101735386680763835789423207666416083908700390324961279), Mod(2455155546008943817740293915197451784769108058161191238065, 6277101735386680763835789423207666416083908700390324961279), 0, Mod(6277101735386680763835789423207666416083908700390324961273, 6277101735386680763835789423207666416083908700390324961279), Mod(3543520448649094507125386237582140722992523532254439990981, 6277101735386680763835789423207666416083908700390324961279), Mod(6277101735386680763835789423207666416083908700390324961270, 6277101735386680763835789423207666416083908700390324961279), Mod(144, 6277101735386680763835789423207666416083908700390324961279), Mod(405994808970639648882882313592906595851778480660607224142, 6277101735386680763835789423207666416083908700390324961279), Mod(5525402385154848923235289274741921730185152131202286251655, 6277101735386680763835789423207666416083908700390324961279), Mod(6234286251230310114240839169629130138801351179850969208331, 6277101735386680763835789423207666416083908700390324961279), 0, 0, 0, 0, 0, 0]
(12:22) gp > x = Mod(602046282375688656758213480587526111916698976636884684818,p)
%5 = Mod(602046282375688656758213480587526111916698976636884684818, 6277101735386680763835789423207666416083908700390324961279)
(12:23) gp > y = Mod(174050332293622031404857552280219410364023488927386650641,p)
%6 = Mod(174050332293622031404857552280219410364023488927386650641, 6277101735386680763835789423207666416083908700390324961279)
(12:23) gp > z = [x,y]
%7 = [Mod(602046282375688656758213480587526111916698976636884684818, 6277101735386680763835789423207666416083908700390324961279), Mod(174050332293622031404857552280219410364023488927386650641, 6277101735386680763835789423207666416083908700390324961279)]
(12:23) gp > ellisoncurve(E,z)
%8 = 1
(12:24) gp > 
Advertisements