Last active
September 24, 2017 21:07
-
-
Save JulianNorton/537c4290894511fdc4fcdf65f940dab4 to your computer and use it in GitHub Desktop.
script to sanitize data to unique hashes
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 | |
from hashlib import blake2b | |
log_file = open("ip_addresses.txt", "r").read().splitlines(); | |
new_file = open("new.csv", 'w') | |
for line in log_file: | |
h = blake2b(key=b'secret_key_change_this!', digest_size=10) | |
h.update((line).encode()) | |
parsed_line = h.hexdigest() | |
new_file.write(parsed_line) | |
print(parsed_line) | |
# Add a line break | |
new_file.write('\n') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment