Skip to content

Instantly share code, notes, and snippets.

View gtank's full-sized avatar
U+2728 THREE EDWARDS CURVES

George Tankersley gtank

U+2728 THREE EDWARDS CURVES
View GitHub Profile
@gtank
gtank / sendrawtest.sh
Created August 26, 2019 20:16
Testing zebra's ability to process Sapling transactions
#!/bin/bash
set -euxo pipefail
# This transaction is test vector 1 from ZIP243: https://zips.z.cash/zip-0243
curl -H 'content-type: application/json' --data-binary '{"jsonrpc": "2.0", "method": "sendrawtransaction", "params": ["0400008085202f890002e7719811893e0000095200ac6551ac636565b2835a0805750200025151481cdd86b3cc4318442117623ceb0500031b3d1a027c2c40590958b7eb13d742a997738c46a458965baf276ba92f272c721fe01f7e9c8e36d6a5e29d4e30a73594bf5098421c69378af1e40f64e125946f62c2fa7b2fecbcb64b6968912a6381ce3dc166d56a1d62f5a8d7551db5fd931325c9a138f49b1a537edcf04be34a9851a7af9db6990ed83dd64af3597c04323ea51b0052ad8084a8b9da948d320dadd64f5431e61ddf658d24ae67c22c8d1309131fc00fe7f235734276d38d47f1e191e00c7a1d48af046827591e9733a97fa6b679f3dc601d008285edcbdae69ce8fc1be4aac00ff2711ebd931de518856878f73476f21a482ec9378365c8f7393c94e2885315eb4671098b79535e790fe53e29fef2b3766697ac32b4f473f468a008e72389fc03880d780cb07fcfaabe3f1a84b27db59a4a153d882d2b2103596555ed9494c6ac893c49723833ec8926c1039586a7afcf4a0d9c731e985d99589c8bb838e8aaf74
@gtank
gtank / dvschnorr.sage
Last active October 5, 2019 17:18
designated-verifier Schnorr (Saeednia)
# Returns (field, curve, scalars, basepoint)
def generate_parameters():
K = GF(2^255 - 19)
a = K(-1)
d = K(-121665/121666)
base_y = K(4/5)
base_x = ((1 - base_y^2) / (-1 - d*(base_y^2))).sqrt()
# Convert Edwards to Montgomery
A = 2*(a+d)/(a-d)
@gtank
gtank / gist:daadb1a90d8c131eb1a5b96b80d59f97
Created February 23, 2019 00:30
the zcash mainnet genesis block, parsed
04000000 uint32 version
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 32 bytes HashPrevBlock
db4d7a85 b768123f 1dff1d4c 4cece700 83b2d27e 117b4ac2 e31d0879 88a5eac4 32 bytes HashMerkleRoot
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 32 bytes hashReserved
90041358 uint32 nTime
ffff071f uint32 nBits
57120000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 32 bytes nNonce
fd4005 3 byte CompactSize Equihash length { 253 { 0x40 0x05 } } = 0x40 + (0x05 << 8) = 1344
package test
import (
"fmt"
"testing"
)
func TestThing(t *testing.T) {
// a := uint64(0x07FFFFFFFFFFFFFFF)
a := uint64(0x1FFF000000000000)
Crypto operations in HS establishment:
GENERATE: service key (must be 1024-bit RSA)
rend_service_load_keys
init_key_from_file
crypto_pk_generate_key
SIGN: ESTABLISH_INTRO cells (once per intro point)
rend_service_intro_has_opened
crypto_pk_private_sign_digest
// RFC 5280 4.1.2.2. Serial Number
// The serial number MUST be a positive integer assigned by the CA to
// each certificate. It MUST be unique for each certificate issued by a
// given CA (i.e., the issuer name and serial number identify a unique
// certificate). CAs MUST force the serialNumber to be a non-negative
// integer.
//
// Given the uniqueness requirements above, serial numbers can be
// expected to contain long integers. Certificate users MUST be able to
// handle serialNumber values up to 20 octets. Conforming CAs MUST NOT
@gtank
gtank / tlsprint.go
Created May 23, 2016 07:09
checks the cert for storage.googleapis.com
package main
import (
"crypto/sha256"
"crypto/tls"
"encoding/hex"
"fmt"
"log"
"strings"
)
$ cat /usr/lib/systemd/system/tor.service
[Unit]
Description=Anonymizing overlay network for TCP
After=syslog.target network.target nss-lookup.target
PartOf=tor-master.service
ReloadPropagatedFrom=tor-master.service
[Service]
Type=notify
NotifyAccess=all

Keybase proof

I hereby claim:

  • I am gtank on github.
  • I am gtank (https://keybase.io/gtank) on keybase.
  • I have a public key whose fingerprint is C154 A663 2C22 10EA 005A 4F73 C760 B462 A5D6 AC5C

To claim this, I am signing this object:

@gtank
gtank / gist:6467517
Last active December 22, 2015 11:39
Freedom
function cookieClick() {
var click = new Event("click");
var goldenCookie = document.getElementById("goldenCookie");
var bigCookie = document.getElementById("bigCookie");
if(goldenCookie.offsetWidth > 0 || goldenCookie.offsetHeight > 0) {
// i can see the cookie!
goldenCookie.dispatchEvent(click);
}
bigCookie.dispatchEvent(click);
setTimeout(cookieClick, 100);