hashlib
Stdlib — SecurityPython 2.5+Intermediate
Secure hashing: SHA-256, SHA-512, MD5, BLAKE2
Quick Info
- Documentation
- Official Docs
- Python Version
- 2.5+
- Dependencies
- None — Python Standard Library
- Install
Included with Python
Learn by Difficulty
Quick Example
python
import hashlib text = "Hello, Python!" md5 = hashlib.md5(text.encode()).hexdigest() sha256 = hashlib.sha256(text.encode()).hexdigest() print(f"MD5: {md5}") print(f"SHA256: {sha256[:32]}...")
The hashlib module is part of Python's standard library. Secure hashing: SHA-256, SHA-512, MD5, BLAKE2.
Try in PlaygroundTags
stdlibsecurityhashingchecksum