Skip to content

Instantly share code, notes, and snippets.

import scrypt
import sys
from itertools import count
from nacl.secret import SecretBox
from nacl.utils import random
from nacl.exceptions import CryptoError
def kdf(password):
N = 16384
r = 1024
@badmofo
badmofo / keybase.md
Last active August 29, 2015 14:05
keybase.md

Keybase proof

I hereby claim:

  • I am badmofo on github.
  • I am lucasryan (https://keybase.io/lucasryan) on keybase.
  • I have a public key whose fingerprint is 53F5 97EF EFA7 5435 016E 711C 2B0A 159F 5735 7FF7

To claim this, I am signing this object:

@badmofo
badmofo / partial_msig_verify.py
Created June 13, 2014 21:59
p2sh multisig verification test script
from pybitcointools import * # available via pip or https://github.com/vbuterin/pybitcointools
from json import dumps
# the tx you sent us
tx_hex = '0100000001f78c40e4a68a6efaea83dcc954550b0dc08b91c372d749cc0ba17934a6d618d801000000b40047304402206d805c798a0b0ae348332284435f4139aeed4935eb4c1322e8bce7d0d3e57efa0220303e13fa08326fa38143471a121cfb4bece404e1565340888587fb8f69914348814c69522103d6ab84e05bd2a9b36e09f08c43ff46358c0ef9f7bdd52ce6f6c1571de760ef852103c945afbe43b21fc864d933f498f362b682515753e9f89f71252ecb6088cc7a332103c14ed38495f194749c728ff3535f1e0286501d44735de87047ed5ef696ad1f4153aeffffffff0250c30000000000001976a914642421cbce0ac31e039ddead2207dfedd04443e488ac30750000000000001976a914c0f3ddcb9c495085252cccbd1b3e2e42d8907d0f88ac00000000'
# example: a 2 of 2 with a valid sig
#tx_hex = '01000000016dbce51ca14b5027bc714baed5bfd9218f30a83e8ef5df52cf8d530bd4627cce01000000910047304402200358faad7809a3571c36a4b18c5c47d9b28a42439d4e149725d8799e7993bf6d022073d2702eded20c9441d770b9a14a2d2b351e962f06c9a260c8fa87622af2c
def password_hashes(password):
alpha = sum([c * (i + 1) % 9 for i,c in enumerate(password)])
beta = (password[0] + password[-1] + len(password)) % 9
if beta == 0:
beta = 20
return alpha, beta
def reverse(seq):
return seq[::-1]