Skip to content

Instantly share code, notes, and snippets.

@Dice64
Dice64 / verify_bey.py
Created August 4, 2013 18:19
Verifying results on Dice64.com
import hashlib
import requests
# Doesn't currently do signature checking, we'll implement that in soon.
URL = "https://dice64.com"
def dsha256(input):
return hashlib.sha256(hashlib.sha256(input.decode('hex')).digest()).hexdigest()
@Dice64
Dice64 / gist:6150064
Created August 4, 2013 11:14
Requests AuthBase for signing requests to dice64.com
from requests.auth import AuthBase
class Dice64Auth(AuthBase):
def __init__(self, userid, sign_key):
self.userid = userid
self.sign_key = sign_key
def __call__(self, r):
r.headers['Authorization'] = "BTC %d:%s" % (self.userid, self.get_signature(r))