Skip to content

Instantly share code, notes, and snippets.

@noonien
Created November 30, 2014 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noonien/d92556183a07c1b5f180 to your computer and use it in GitHub Desktop.
Save noonien/d92556183a07c1b5f180 to your computer and use it in GitHub Desktop.
import struct
import hashlib
from datetime import datetime
t = datetime.now()
ci = 0
for i in xrange(0, 2**42):
buf = struct.pack('Q', i)
m = hashlib.sha256()
m.update(buf)
m.digest()
tn = datetime.now()
dt = tn -t
if dt.seconds >= 5:
print '%.3f KHashes/sec' % ((i - ci) / 5. / 10**3)
ci = i
t = tn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment