Skip to main content

A collection of cryptographic hashing algorithms implemented in Python

Project description

Hashbase

Develop Deploy PyPi version Python versions Downloads

A Python package to compute the hash value of an input string using various cryptographic hashing algorithms.

Definition: A hash function is any function that can be used to map data of arbitrary size to fixed-size values (source).

📝 Table of Contents

🏁 Getting Started

To install the package directly from PyPi:

$ pip install hashbase

🎈 Usage

Check out: examples/hash.py

Import the required hash function(s)

from hashbase import (
    MD2,
    MD4,
    MD5,
    SHA1,
    SHA224,
    SHA256,
    SHA384,
    SHA512,
    SHA512_224,
    SHA512_256,
    RIPEMD128,
    CRC8,
    CRC16,
)

Generate the hash of the input string

message: str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!"

print(f"MD2: {MD2().generate_hash(message)}")
print(f"MD4: {MD4().generate_hash(message)}")
print(f"MD5: {MD5().generate_hash(message)}")
print(f"SHA-1: {SHA1().generate_hash(message)}")
print(f"SHA-224: {SHA224().generate_hash(message)}")
print(f"SHA-256: {SHA256().generate_hash(message)}")
print(f"SHA-384: {SHA384().generate_hash(message)}")
print(f"SHA-512: {SHA512().generate_hash(message)}")
print(f"SHA-512/224: {SHA512_224().generate_hash(message)}")
print(f"SHA-512/256: {SHA512_256().generate_hash(message)}")
print(f"RIPEMD-128: {RIPEMD128().generate_hash(message)}")
print(f"CRC-8: {CRC8().generate_hash(message)}")
print(f"CRC-16: {CRC16().generate_hash(message)}")

The output of the above cell

MD2: ebd512bd0162b1c3723f3326f352f50d
MD4: c9066409e6cd86045088ab7e130b7c51
MD5: 641ba60288c17a2da5090077eb8958ad
SHA-1: ad75aab2b0f1b220dcba62f48ce86b387aad225f
SHA-224: c50557bb4de98a3efd31b24cab5b8fe0ed9e081bdd5a2842c646e007
SHA-256: aaa7932dcc5db1e35047bcd1bb857f85c23fc647aebd08290b626b797a336e24
SHA-384: 13fbfe276cd33cf7f219428be7216ed72f913fcf529902b9ff073300fd92f335b4a3e85729d6a1bbc73bca5475e52b8a
SHA-512: cd2abc78ef9694299e3bda722f9535735e4481a07cc422e1609dbd67b126b82f1b72f829f7c4074ded396d25d8363872b60197a421f5f46a1eb430797eb3cfae
SHA-512/224: 4b685ee6fb3fa679785512dd0178c3523c1c4f11cd88ef207ffc8500
SHA-512/256: 4110ce7e37cde62c723f1ef2b7826ff02712a6789642453e5ab9a6ccbde8b0c5
RIPEMD-128: 9eb4516a0b0cfedd3e5cf41eb7c85285
CRC-8: 0x15
CRC-16: 0x3958

📦 Contents

Message-Digest (MD)

  • MD2 (hashbase.MD2)
  • MD4 (hashbase.MD4)
  • MD5 (hashbase.MD5)

Secure Hash Algorithm (SHA)

  • SHA-1 (hashbase.SHA1)
  • SHA-224 (hashbase.SHA224)
  • SHA-256 (hashbase.SHA256)
  • SHA-512 (hashbase.SHA512)
  • SHA-512/224 (hashbase.SHA512_224)
  • SHA-512/256 (hashbase.SHA512_256)
  • SHA-384 (hashbase.SHA384)

RIPE Message Digest (RIPEMD)

  • RIPEMD-128 (hashbase.RIPEMD128)

Cyclic Redundancy Check (CRC)

  • CRC-8 (hashbase.CRC8)
  • CRC-16 (hashbase.CRC16)

Contributing

  • Post any issues and suggestions on the GitHub issues page.
  • To contribute, fork the project and then create a pull request back to master.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hashbase-1.1.1.tar.gz (18.2 kB view hashes)

Uploaded Source

Built Distribution

hashbase-1.1.1-py3-none-any.whl (29.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page