🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

fast-hashes

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-hashes

Lightweight, fast hashing utilities wrapping hashlib with BLAKE2 support

pipPyPI
Version
0.1.0
Weekly downloads
0
Maintainers
1
Weekly downloads
 

fast-hashes

Lightweight, zero-dependency* hashing utilities for Python — wrapping hashlib with a clean API and BLAKE2b support.

*Only colorama for pretty terminal output on non-Linux platforms.

PyPI Python License: MIT

Installation

pip install fast-hashes

Note: Native optimized bindings are available on Linux only (Ubuntu 20.04+, Debian 11+, Fedora 38+). On other platforms the library falls back to pure-Python hashlib wrappers.

Quick Start

from fast_hashes import sha256, md5, blake2

# String input
print(sha256("hello world"))
# → b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9

# Bytes input
print(md5(b"binary data"))
# → 4c3c7c067634daec9716a80ea886d734

# BLAKE2b with custom digest size
print(blake2("fast!", digest_size=16))
# → 32-char hex string

API Reference

FunctionDescriptionReturns
md5(data)MD5 hex digeststr
sha1(data)SHA-1 hex digeststr
sha256(data)SHA-256 hex digeststr
sha512(data)SHA-512 hex digeststr
blake2(data, digest_size=32)BLAKE2b hex digeststr

All functions accept str or bytes. Strings are automatically UTF-8 encoded.

Supported Platforms

PlatformStatus
Ubuntu 20.04+✅ Full support (native bindings)
Debian 11+✅ Full support (native bindings)
Fedora 38+✅ Full support (native bindings)
Arch Linux✅ Full support (native bindings)
macOS⚠️ Fallback (pure Python)
Windows⚠️ Fallback (pure Python)

Benchmarks

Compared to raw hashlib calls, fast-hashes adds negligible overhead (~2μs per call) while providing:

  • Automatic string-to-bytes encoding
  • Consistent hex output
  • BLAKE2b with configurable digest size
  • Platform compatibility checks

License

MIT

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts