Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
screenshot_dir=/home/andrew/screenshots/
screenshot_log=$screenshot_dir/screenshots.log
host=cryptarch.net
host_img_root=/var/www/html/img
host_img_urlbase=https://cryptarch.net/img/
img_file=${screenshot_dir}/$(date -Iseconds)
img_file+=.png
@andrewbuss
andrewbuss / ecc.m
Created November 7, 2015 20:00
Elliptic curve point operations in mathematica
AddPoint[p_, q_] := (
If[p[[1]] == 0 && p[[2]] == 0,(* Identity represented as {0,0} *)
s = Mod[(p[[2]] - q[[2]])*PowerMod[p[[1]] - q[[1]], -1, n], n];
rx = PowerMod[s, 2, n] - p[[1]] - q[[1]];
ry = s*(p[[1]] - rx) - p[[2]];
Mod[{rx, ry}, n]
]
)
DoublePoint[p_] := (
s = Mod[3*PowerMod[p[[1]], 2, n] + a, n]*PowerMod[2*p[[2]], -1, n];
### Keybase proof
I hereby claim:
* I am andrewbuss on github.
* I am abuss (https://keybase.io/abuss) on keybase.
* I have a public key whose fingerprint is 4CE2 84D5 CA16 DF0C 88F6 8565 BCDE 836E 7BD6 4DF0
To claim this, I am signing this object: