Skip to content

Instantly share code, notes, and snippets.

@JulianNorton
Last active September 24, 2017 21:07
Show Gist options
  • Save JulianNorton/537c4290894511fdc4fcdf65f940dab4 to your computer and use it in GitHub Desktop.
Save JulianNorton/537c4290894511fdc4fcdf65f940dab4 to your computer and use it in GitHub Desktop.
script to sanitize data to unique hashes
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