hash-forge


Namehash-forge JSON
Version 1.1.1 PyPI version JSON
download
home_pageNone
SummaryHash Forge is a lightweight Python library designed to simplify the process of hashing and verifying data using a variety of secure hashing algorithms.
upload_time2024-10-21 22:42:04
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords argon2 bcrypt blake2 hash pbkdf2 scrypt security
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Hash Forge

[![PyPI version](https://badge.fury.io/py/hash-forge.svg)](https://pypi.org/project/hash-forge/) ![Build Status](https://github.com/Zozi96/hash-forge/actions/workflows/unittest.yml/badge.svg)  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Python Versions](https://img.shields.io/pypi/pyversions/hash-forge.svg)](https://pypi.org/project/hash-forge/) [![Downloads](https://pepy.tech/badge/hash-forge)](https://pepy.tech/project/hash-forge) [![GitHub issues](https://img.shields.io/github/issues/Zozi96/hash-forge)](https://github.com/Zozi96/hash-forge/issues) ![Project Status](https://img.shields.io/badge/status-active-brightgreen.svg) [![Code Style: Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![Contributions welcome](https://img.shields.io/badge/contributions-welcome-blue.svg)](https://github.com/Zozi96/hash-forge/issues)

**Hash Forge** is a lightweight Python library designed to simplify the process of hashing and verifying data using a variety of secure hashing algorithms.

## Overview

Hash Forge is a flexible and secure hash management tool that supports multiple hashing algorithms. This tool allows you to hash and verify data using popular hash algorithms, making it easy to integrate into projects where password hashing or data integrity is essential.

## Features

- **Multiple Hashing Algorithms**: Supports bcrypt, Scrypt, Argon2, Blake2 and PBKDF2.
- **Hashing and Verification**: Easily hash strings and verify their integrity.
- **Rehash Detection**: Automatically detects if a hash needs to be rehashed based on outdated parameters or algorithms.
- **Flexible Integration**: Extendible to add new hashing algorithms as needed.

## Installation

```bash
pip install hash-forge
```

### Optional Dependencies

Hash Forge provides optional dependencies for specific hashing algorithms. To install these, use:

- **bcrypt** support:

  ```bash
  pip install "hash-forge[bcrypt]"
  ```
- **Argon2** support:

  ```bash
  pip install "hash-forge[argon2]"
  ```

## Usage

### Basic Example

```python
from hash_forge import HashManager
from hash_forge.pbkdf2_hasher import PBKDF2Hasher

# Initialize HashManager with PBKDF2Hasher
hash_manager = HashManager(PBKDF2Hasher())

# Hash a string
hashed_value = hash_manager.hash("my_secure_password")

# Verify the string against the hashed value
is_valid = hash_manager.verify("my_secure_password", hashed_value)
print(is_valid)  # Outputs: True

# Check if the hash needs rehashing
needs_rehash = hash_manager.needs_rehash(hashed_value)
print(needs_rehash)  # Outputs: False
```

> **Note:** The first hasher provided during initialization of `HashManager` will be the **preferred hasher** used for hashing operations, though any available hasher can be used for verification.

### Hashers

Currently supported hashers:

- **PBKDF2** (default)
- **bcrypt**
- **Argon2**
- **Scrypt**
- **Blake2**

You can initialize `HashManager` with one or more hashers:

```python
from hash_forge import HashManager
from hash_forge.pbkdf2_hasher import PBKDF2Sha256Hasher
from hash_forge.bcrypt_hasher import BCryptSha256Hasher
from hash_forge.scrypt_hasher import ScryptHasher
from hash_forge.blake2_hasher import Blake2Hasher

hash_manager = HashManager(PBKDF2Sha256Hasher(), BCryptSha256Hasher(), ScryptHasher(), Blake2Hasher(key='my_secret')))
```

### Verifying a Hash

Use the `verify` method to compare a string with its hashed counterpart:

```python
is_valid = hash_manager.verify("my_secure_password", hashed_value)
```

### Checking for Rehashing

You can check if a hash needs to be rehashed (e.g., if the hashing algorithm parameters are outdated):

```python
needs_rehash = hash_manager.needs_rehash(hashed_value)
```

## Contributing

Contributions are welcome! Please feel free to submit issues or pull requests to help improve the project.

## License

This project is licensed under the MIT License.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "hash-forge",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "argon2, bcrypt, blake2, hash, pbkdf2, scrypt, security",
    "author": null,
    "author_email": "Zozi <zozi.fer96@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/3d/c4/0ce51ced211031dab2ba1b49f0ec6085deec0fd39e9b5e52617e42ce1d52/hash_forge-1.1.1.tar.gz",
    "platform": null,
    "description": "# Hash Forge\n\n[![PyPI version](https://badge.fury.io/py/hash-forge.svg)](https://pypi.org/project/hash-forge/) ![Build Status](https://github.com/Zozi96/hash-forge/actions/workflows/unittest.yml/badge.svg)  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Python Versions](https://img.shields.io/pypi/pyversions/hash-forge.svg)](https://pypi.org/project/hash-forge/) [![Downloads](https://pepy.tech/badge/hash-forge)](https://pepy.tech/project/hash-forge) [![GitHub issues](https://img.shields.io/github/issues/Zozi96/hash-forge)](https://github.com/Zozi96/hash-forge/issues) ![Project Status](https://img.shields.io/badge/status-active-brightgreen.svg) [![Code Style: Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![Contributions welcome](https://img.shields.io/badge/contributions-welcome-blue.svg)](https://github.com/Zozi96/hash-forge/issues)\n\n**Hash Forge** is a lightweight Python library designed to simplify the process of hashing and verifying data using a variety of secure hashing algorithms.\n\n## Overview\n\nHash Forge is a flexible and secure hash management tool that supports multiple hashing algorithms. This tool allows you to hash and verify data using popular hash algorithms, making it easy to integrate into projects where password hashing or data integrity is essential.\n\n## Features\n\n- **Multiple Hashing Algorithms**: Supports bcrypt, Scrypt, Argon2, Blake2 and PBKDF2.\n- **Hashing and Verification**: Easily hash strings and verify their integrity.\n- **Rehash Detection**: Automatically detects if a hash needs to be rehashed based on outdated parameters or algorithms.\n- **Flexible Integration**: Extendible to add new hashing algorithms as needed.\n\n## Installation\n\n```bash\npip install hash-forge\n```\n\n### Optional Dependencies\n\nHash Forge provides optional dependencies for specific hashing algorithms. To install these, use:\n\n- **bcrypt** support:\n\n  ```bash\n  pip install \"hash-forge[bcrypt]\"\n  ```\n- **Argon2** support:\n\n  ```bash\n  pip install \"hash-forge[argon2]\"\n  ```\n\n## Usage\n\n### Basic Example\n\n```python\nfrom hash_forge import HashManager\nfrom hash_forge.pbkdf2_hasher import PBKDF2Hasher\n\n# Initialize HashManager with PBKDF2Hasher\nhash_manager = HashManager(PBKDF2Hasher())\n\n# Hash a string\nhashed_value = hash_manager.hash(\"my_secure_password\")\n\n# Verify the string against the hashed value\nis_valid = hash_manager.verify(\"my_secure_password\", hashed_value)\nprint(is_valid)  # Outputs: True\n\n# Check if the hash needs rehashing\nneeds_rehash = hash_manager.needs_rehash(hashed_value)\nprint(needs_rehash)  # Outputs: False\n```\n\n> **Note:** The first hasher provided during initialization of `HashManager` will be the **preferred hasher** used for hashing operations, though any available hasher can be used for verification.\n\n### Hashers\n\nCurrently supported hashers:\n\n- **PBKDF2** (default)\n- **bcrypt**\n- **Argon2**\n- **Scrypt**\n- **Blake2**\n\nYou can initialize `HashManager` with one or more hashers:\n\n```python\nfrom hash_forge import HashManager\nfrom hash_forge.pbkdf2_hasher import PBKDF2Sha256Hasher\nfrom hash_forge.bcrypt_hasher import BCryptSha256Hasher\nfrom hash_forge.scrypt_hasher import ScryptHasher\nfrom hash_forge.blake2_hasher import Blake2Hasher\n\nhash_manager = HashManager(PBKDF2Sha256Hasher(), BCryptSha256Hasher(), ScryptHasher(), Blake2Hasher(key='my_secret')))\n```\n\n### Verifying a Hash\n\nUse the `verify` method to compare a string with its hashed counterpart:\n\n```python\nis_valid = hash_manager.verify(\"my_secure_password\", hashed_value)\n```\n\n### Checking for Rehashing\n\nYou can check if a hash needs to be rehashed (e.g., if the hashing algorithm parameters are outdated):\n\n```python\nneeds_rehash = hash_manager.needs_rehash(hashed_value)\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit issues or pull requests to help improve the project.\n\n## License\n\nThis project is licensed under the MIT License.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Hash Forge is a lightweight Python library designed to simplify the process of hashing and verifying data using a variety of secure hashing algorithms.",
    "version": "1.1.1",
    "project_urls": {
        "Homepage": "https://github.com/Zozi96/hash-forge",
        "Issue Tracker": "https://github.com/Zozi96/hash-forge/issues",
        "Repository": "https://github.com/Zozi96/hash-forge"
    },
    "split_keywords": [
        "argon2",
        " bcrypt",
        " blake2",
        " hash",
        " pbkdf2",
        " scrypt",
        " security"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f195091b4373daec562562aaa6c086e8f8388b3fc540c4af78f0c6a0a7d1e863",
                "md5": "dcf7c79b87a2a6e6afa39b8be0b50af3",
                "sha256": "83367007c6fa6adc54787c083b9d0de1440d7c65d17d6701b238c795dca2a156"
            },
            "downloads": -1,
            "filename": "hash_forge-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dcf7c79b87a2a6e6afa39b8be0b50af3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 12362,
            "upload_time": "2024-10-21T22:42:03",
            "upload_time_iso_8601": "2024-10-21T22:42:03.206779Z",
            "url": "https://files.pythonhosted.org/packages/f1/95/091b4373daec562562aaa6c086e8f8388b3fc540c4af78f0c6a0a7d1e863/hash_forge-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3dc40ce51ced211031dab2ba1b49f0ec6085deec0fd39e9b5e52617e42ce1d52",
                "md5": "960d1b3c57bc6d548ab4db3e75243308",
                "sha256": "b54c5516c8e50b0d3771d201a8fa4a5f0c12b6c67b49202812a5caadb7614dd0"
            },
            "downloads": -1,
            "filename": "hash_forge-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "960d1b3c57bc6d548ab4db3e75243308",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 25557,
            "upload_time": "2024-10-21T22:42:04",
            "upload_time_iso_8601": "2024-10-21T22:42:04.740231Z",
            "url": "https://files.pythonhosted.org/packages/3d/c4/0ce51ced211031dab2ba1b49f0ec6085deec0fd39e9b5e52617e42ce1d52/hash_forge-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-21 22:42:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Zozi96",
    "github_project": "hash-forge",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "hash-forge"
}
        
Elapsed time: 0.37065s