Skip to content

Instantly share code, notes, and snippets.

@cyrus-and
Last active July 15, 2017 19:53
Show Gist options
  • Save cyrus-and/fb49fdd778fece41244972be88ce5705 to your computer and use it in GitHub Desktop.
Save cyrus-and/fb49fdd778fece41244972be88ce5705 to your computer and use it in GitHub Desktop.
$ ./hashall.py asd
BLAKE2s256  256  2521f2bce24415ca048d86e965b49e9c0695547dffe6b441cc48cfb0043e6157
blake2b512  512  e4139471a1800a05b5e02b56669f025d01e33c5655153a4faa29f694f7849c63f97577fcc3e397d1138cf4640e0c2053e74a7af646598310d076dc6f15d1af50
SHA256      256  688787d8ff144c502c7f5cffaafe2cc588d86079f9de88304c26b0cb99ce91c6
SHA512      512  e54ee7e285fbb0275279143abc4c554e5314e7b417ecac83a5984a964facbaad68866a2841c3e83ddf125a2985566261c4014f9f960ec60253aebcda9513a9b4
blake2s256  256  2521f2bce24415ca048d86e965b49e9c0695547dffe6b441cc48cfb0043e6157
MD4         128  61118995d26bef582a59dec9220483e8
sha256      256  688787d8ff144c502c7f5cffaafe2cc588d86079f9de88304c26b0cb99ce91c6
sha512      512  e54ee7e285fbb0275279143abc4c554e5314e7b417ecac83a5984a964facbaad68866a2841c3e83ddf125a2985566261c4014f9f960ec60253aebcda9513a9b4
RIPEMD160   160  7e1913bb41fa854cca1df5ef6c80a0858c8e7d13
md5         128  7815696ecbf1c96e6894b779456d330e
whirlpool   512  822a19edb23fd5f1d01b9e547bf3a8e15b13b7569d5f42c382be59a1ba4244a5bf71208935f1512b929c14dd218bc2312fa63bce11617f35202018b523e63823
SHA1        160  f10e2821bbbea527ea02200352313bc059445190
SHA224      224  cda1d665441ef8120c3d3e82610e74ab0d3b043763784676654d8ef1
SHA384      384  91389ee5448e9d7a00f2f250e3d83beff18f1177a04bd0a2019c27b0493bfa072130dfd1625c7b835d0bb008895272f8
MD5-SHA1    288  7815696ecbf1c96e6894b779456d330ef10e2821bbbea527ea02200352313bc059445190
BLAKE2b512  512  e4139471a1800a05b5e02b56669f025d01e33c5655153a4faa29f694f7849c63f97577fcc3e397d1138cf4640e0c2053e74a7af646598310d076dc6f15d1af50
md4         128  61118995d26bef582a59dec9220483e8
MD5         128  7815696ecbf1c96e6894b779456d330e
sha1        160  f10e2821bbbea527ea02200352313bc059445190
sha224      224  cda1d665441ef8120c3d3e82610e74ab0d3b043763784676654d8ef1
ripemd160   160  7e1913bb41fa854cca1df5ef6c80a0858c8e7d13
sha384      384  91389ee5448e9d7a00f2f250e3d83beff18f1177a04bd0a2019c27b0493bfa072130dfd1625c7b835d0bb008895272f8
md5-sha1    288  7815696ecbf1c96e6894b779456d330ef10e2821bbbea527ea02200352313bc059445190
#!/usr/bin/env python
import hashlib
import sys
_max_len = max(map(len, hashlib.algorithms_available))
def hash(data, algorithm):
h = hashlib.new(algorithm)
h.update(data)
return h.hexdigest()
def hash_all(data):
hashes = dict()
for algorithm in hashlib.algorithms_available:
hash_string = hash(data, algorithm)
hashes[algorithm] = hash(data, algorithm)
return hashes
def print_table(data):
hashes = hash_all(data)
for algorithm, hash_string in hashes.iteritems():
label = algorithm.ljust(_max_len)
hash_bit_size = len(hash_string) / 2 * 8
print('{} {} {}'.format(label, hash_bit_size, hash_string))
if __name__ == '__main__':
if len(sys.argv) == 1:
data = sys.stdin.read();
else:
data = ' '.join(sys.argv[1:])
print_table(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment