Skip to content

Instantly share code, notes, and snippets.

@HelloZeroNet
HelloZeroNet / opensslVerify2.py
Last active June 19, 2017 23:36
Alternative openssl verify
#!/usr/bin/env python
##
## @file contrib/verifymessage/python/terracoin_verifymessage.py
## @brief terracoin signed message verification sample script.
## @author unknown author ; found on pastebin
##
import ctypes
import ctypes.util
import hashlib
@HelloZeroNet
HelloZeroNet / openssl_verify.py
Last active August 29, 2015 14:20
Bitcoin sign recover address
from pybitcointools import bitcoin as btctools
import time, hashlib
priv = "5JsunC55XGVqFQj5kPGK4MWgTL26jKbnPhjnmchSNPo75XXCwtk"
address = "1N2XWu5soeppX2qUjvrf81rpdbShKJrjTr"
sign = btctools.ecdsa_sign("hello", priv)
import base64
def VerifyMessage(address, hash, sig):
sig = base64.b64decode(sig)
#
# key.py - OpenSSL wrapper
# Source: git://github.com/joric/brutus.git
# which was forked from git://github.com/samrushing/caesure.git
#
import ctypes
import ctypes.util
ssl = ctypes.cdll.LoadLibrary (ctypes.util.find_library ('ssl') or 'libeay32')
plugined_cache = {}
plugins = {}
def plugined(base_class):
class_name = base_class.__name__
if class_name in plugined_cache:
PluginedClass = plugined_cache[class_name]
else:
classes = plugins[class_name]+[base_class]
classes.reverse()
PluginedClass = type(class_name, tuple(classes), dict())
@HelloZeroNet
HelloZeroNet / bitcoinbar.html
Created March 19, 2015 16:34
Bitcoin donate bar
<html>
<body>
<style>
.bitcoinbar {
width: 150px; margin-top: 5px; display: inline-block; height: 20px; border-radius: 5px; position: relative;
font-family: Consolas, Monospace; background-color: #eee; color: black; vertical-align: bottom; text-decoration: none
}
.bitcoinbar .progress {
text-align: center; display: block; position: relative;
font-size: 11px; vertical-align: middle; line-height: 22px;
@HelloZeroNet
HelloZeroNet / gist:b25b144506a3f8afbbda
Created March 19, 2015 15:02
Simple plugin benchmark
import time
# No plugin (without getattr 0.056s, with getattr 0.110s)
class Request(object):
def __init__(self):
pass
def route(self, req):
@HelloZeroNet
HelloZeroNet / UpnpPunch.py
Last active August 29, 2015 14:16
UpnpPunch bind patch
import gevent
from gevent import socket
from gevent import monkey
monkey.patch_socket()
import re, urllib2, httplib, logging
from urlparse import urlparse
from xml.dom.minidom import parseString