diff options
Diffstat (limited to 'Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/ecc/jacobian_double.se')
-rw-r--r-- | Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/ecc/jacobian_double.se | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/ecc/jacobian_double.se b/Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/ecc/jacobian_double.se new file mode 100644 index 000000000..b7d8221a6 --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/ecc/jacobian_double.se @@ -0,0 +1,16 @@ +def call(axn, axd, ayn, ayd): + if !axn and !ayn: + return([0, 1, 0, 1], 4) + with P = -4294968273: + # No need to add (A, 1) because A = 0 for bitcoin + with mn = mulmod(mulmod(mulmod(axn, axn, P), 3, P), ayd, P): + with md = mulmod(mulmod(axd, axd, P), mulmod(ayn, 2, P), P): + with msqn = mulmod(mn, mn, P): + with msqd = mulmod(md, md, P): + with xn = addmod(mulmod(msqn, axd, P), P - mulmod(msqd, mulmod(axn, 2, P), P), P): + with xd = mulmod(msqd, axd, P): + with mamxn = mulmod(addmod(mulmod(axn, xd, P), P - mulmod(axd, xn, P), P), mn, P): + with mamxd = mulmod(mulmod(axd, xd, P), md, P): + with yn = addmod(mulmod(mamxn, ayd, P), P - mulmod(mamxd, ayn, P), P): + with yd = mulmod(mamxd, ayd, P): + return([xn, xd, yn, yd], 4) |