Constant-ize constants and prime field

This commit is contained in:
Steve Dee 2014-01-23 11:44:20 -08:00
parent 26da497892
commit 09277c86bc

View File

@ -5,45 +5,45 @@
=> %= . => %= .
+ +
=> + => +
|% =+ b=256
++ b 256 =+ q=(sub (bex 255) 19)
++ q (sub (bex 255) 19) =+ fq=~(. fo q)
++ l =+ ^= l
%+ add %+ add
(bex 252) (bex 252)
27.742.317.777.372.353.535.851.937.790.883.648.493 27.742.317.777.372.353.535.851.937.790.883.648.493
++ d (~(dif fo q) 0 (~(fra fo q) 121.665 121.666)) =+ d=(dif.fq 0 (fra.fq 121.665 121.666))
++ ii (~(exp fo q) (div (dec q) 4) 2) =+ ii=(exp.fq (div (dec q) 4) 2)
:: |%
++ norm |=(x=@ ?:(=(0 (mod x 2)) x (sub q x))) ++ norm |=(x=@ ?:(=(0 (mod x 2)) x (sub q x)))
++ xrec ++ xrec
|= y=@ ^- @ |= y=@ ^- @
=+ ^= xx =+ ^= xx
%+ mul (~(dif fo q) (mul y y) 1) %+ mul (dif.fq (mul y y) 1)
(~(inv fo q) +(:(mul d y y))) (inv.fq +(:(mul d y y)))
=+ x=(~(exp fo q) (div (add 3 q) 8) xx) =+ x=(exp.fq (div (add 3 q) 8) xx)
?: !=(0 (~(dif fo q) (mul x x) (~(sit fo q) xx))) ?: !=(0 (dif.fq (mul x x) (sit.fq xx)))
(norm (~(pro fo q) x ii)) (norm (pro.fq x ii))
(norm x) (norm x)
:: ::
++ bby (~(pro fo q) 4 (~(inv fo q) 5)) ++ bby (pro.fq 4 (inv.fq 5))
++ bb [(xrec bby) bby] ++ bb [(xrec bby) bby]
:: ::
++ ward ++ ward
|= [pp=[@ @] qq=[@ @]] ^- [@ @] |= [pp=[@ @] qq=[@ @]] ^- [@ @]
=+ dp=:(~(pro fo q) d -.pp -.qq +.pp +.qq) =+ dp=:(pro.fq d -.pp -.qq +.pp +.qq)
=+ ^= xt =+ ^= xt
%+ ~(pro fo q) %+ pro.fq
%+ ~(sum fo q) %+ sum.fq
(~(pro fo q) -.pp +.qq) (pro.fq -.pp +.qq)
(~(pro fo q) -.qq +.pp) (pro.fq -.qq +.pp)
(~(inv fo q) (~(sum fo q) 1 dp)) (inv.fq (sum.fq 1 dp))
=+ ^= yt =+ ^= yt
%+ ~(pro fo q) %+ pro.fq
%+ ~(sum fo q) %+ sum.fq
(~(pro fo q) +.pp +.qq) (pro.fq +.pp +.qq)
(~(pro fo q) -.pp -.qq) (pro.fq -.pp -.qq)
(~(inv fo q) (~(dif fo q) 1 dp)) (inv.fq (dif.fq 1 dp))
[xt yt] [xt yt]
:: ::
++ scam ++ scam
@ -99,11 +99,11 @@
++ curv ++ curv
|= [x=@ y=@] ^- ? |= [x=@ y=@] ^- ?
.= 0 .= 0
%+ ~(dif fo q) %+ dif.fq
%+ ~(sum fo q) %+ sum.fq
(~(pro fo q) (sub q (~(sit fo q) x)) x) (pro.fq (sub q (sit.fq x)) x)
(~(pro fo q) y y) (pro.fq y y)
(~(sum fo q) 1 :(~(pro fo q) d x x y y)) (sum.fq 1 :(pro.fq d x x y y))
++ decp ++ decp
|= s=@ ^- [@ @] |= s=@ ^- [@ @]
=+ y=(cut 0 [0 (dec b)] s) =+ y=(cut 0 [0 (dec b)] s)