Created
November 26, 2013 23:46
-
-
Save ashishb/7668357 to your computer and use it in GitHub Desktop.
SHA256 demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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