Skip to content

Instantly share code, notes, and snippets.

@ashishb
Created November 26, 2013 23:46
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 ashishb/7668357 to your computer and use it in GitHub Desktop.
Save ashishb/7668357 to your computer and use it in GitHub Desktop.
SHA256 demo
import hashlib
even_count = 0
odd_count = 0
for x in xrange(0, 1000, 1):
if int(hashlib.sha256(str(x)).hexdigest(), 16)%2 == 0:
even_count += 1
else:
odd_count += 1
print 'event_count: %d' % even_count
print 'odd_count: %d' % odd_count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment