Created
February 14, 2011 00:35
-
-
Save ikasamt/825342 to your computer and use it in GitHub Desktop.
sha256関数の呼び出し方と実行速度確認
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 | |
import datetime | |
loop_size = 100 *1000 | |
start_time = datetime.datetime.now() | |
for i in range(loop_size): | |
source_data = '123456%d' % i | |
v = hashlib.sha256(source_data).hexdigest() | |
end_time = datetime.datetime.now() | |
print (end_time - start_time) / loop_size | |
print v | |
print len(v) | |
# (MacbookAir core2duo) | |
# ==> | |
# 0:00:00.000008 | |
# 8bc57ea62f0757ce5587e697541d5d78b48789a934491870f58fa96ce3d6b89f | |
# 64 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment