Created
August 3, 2017 23:34
-
-
Save tancnle/389eb9adea2dc996fae4e4e5612d64bf to your computer and use it in GitHub Desktop.
SHA1 vs MD5 bechmark
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 pytest | |
foo = b'The lazy fox jumps over the running dogs' | |
def test_sha1(benchmark): | |
sha1 = hashlib.sha1() | |
sha1.update(foo) | |
benchmark(sha1.hexdigest) | |
def test_md5(benchmark): | |
md5 = hashlib.md5() | |
md5.update(foo) | |
benchmark(md5.hexdigest) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very cool!