Last active
November 19, 2017 22:17
-
-
Save mattbillenstein/39f0399e842c63355c74173e34d49965 to your computer and use it in GitHub Desktop.
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 time | |
find = '07123E1F482356C415F684407A3B8723E10B2CBBC0B8FCD6282C49D37C9C1ABC' | |
length = len(find) | |
# dd if=/dev/urandom of=200mb.txt bs=1000000 count=200 | |
# echo '07123E1F482356C415F684407A3B8723E10B2CBBC0B8FCD6282C49D37C9C1ABC' >> 200mb.txt | |
data = open('200mb.txt').read() | |
found = 0 | |
start = time.time() | |
i = 0 | |
for i in xrange(len(data)): | |
if data[i] == find[found]: | |
found += 1 | |
else: | |
found = 0 | |
if found == length: | |
print 'found at ', i | |
found = 0 | |
print 'scan took', time.time() - start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment