Securing messages using Hashlib in python

Hashlib is an in built python module that implements a common interface to many different secure hash and message digest algorithms.

Python secure hash values are used in storing password in encrypted form and it is impossible to retrieve the input data from hash values.

Usage

import hashlib
print(hashlib.algorithms_available)
# A set containing the names of the hash algorithms that are
# available in the running Python interpreter.


print(hashlib.algorithms_guaranteed)
# A set containing the names of the hash algorithms
# guaranteed to be supported by this module on all platforms.
code = "This is SECRET MESSAGE".encode()
md5 = hashlib.md5(code).hexdigest()
sha1 = hashlib.sha1(code).hexdigest()
sha256 = hashlib.sha256(code).hexdigest()
sha512 = hashlib.sha512(code).hexdigest()
sha3_256 = hashlib.sha3_256(code).hexdigest()
sha3_512 = hashlib.sha3_512(code).hexdigest()
blake2s = hashlib.blake2s(code).hexdigest()
blake2b = hashlib.blake2b(code).hexdigest()
sha3_384 = hashlib.sha3_384(code).hexdigest()
print(md5)
print(sha1)
print(sha256)
print(sha512)
print(sha3_256)
print(sha3_512)
print(blake2s)
print(blake2b)
print(sha3_384)

If you would like to contribute to Hackzism you can also write an article and mail to  hackzism.hack@gmail.com
Your article will be published on our home page.

Comments

Popular Posts