hasher-package

A customisable hashing algorithm.

https://github.com/greyteamtoolbox/hasher-package

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.7%) to scientific vocabulary
Last synced: 10 months ago · JSON representation ·

Repository

A customisable hashing algorithm.

Basic Info
  • Host: GitHub
  • Owner: GreyTeamToolbox
  • License: mit
  • Language: Python
  • Default Branch: master
  • Size: 135 KB
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 3
  • Releases: 0
Created almost 2 years ago · Last pushed 10 months ago
Metadata Files
Readme Contributing Funding License Code of conduct Citation Codeowners Security

README.md

GreyTeamToolbox logo
Github Build Status License Created
Release Released Commits since release

Overview

THIS IS WORK IN PROGRESS!!

Hasher is a customizable hashing tool implemented in Python. It allows users to hash various data types such as strings, integers, floats, lists, dictionaries, bytes, and even files with a standalone, configurable hashing algorithm. It offers additional security features such as configurable rounds, block sizes, and hash lengths, as well as optional salt and pepper for each hash.

Features

  • Supports hashing of multiple data types: str, int, float, list, dict, tuple, bytes, and files.
  • Customizable parameters:
    • rounds: Number of rounds for the hashing process.
    • block_size: Size of the data blocks used for hashing.
    • hash_length: Length of the final hash output.
    • salt: Optional salt to add randomness to the hash.
    • pepper: An additional user-defined key that acts as a second salt.
  • Provides both base64 and hex output formats.
  • Standalone script that does not depend on external libraries like hashlib or hmac.

Installation

Simply download or clone this repository. No additional libraries are required.

Usage

Import and Initialize

```python from configurable_hasher import ConfigurableHasher

Initialize the hasher with custom parameters

hasher = ConfigurableHasher( rounds=100, blocksize=512, hashlength=256, salt="customsalt", pepper="extrasecretpepper", outputformat="base64" ) ```

Hashing Data

```python

Hash a string

data = "hello world" hashvalue = hasher.hash(data) print(f"Hash of '{data}': {hashvalue}")

Hash an integer

integerdata = 12345 integerhash = hasher.hash(integerdata) print(f"Hash of {integerdata}: {integer_hash}")

Hash a file

filepath = "example.txt" filehash = hasher.hashfile(filepath) print(f"Hash of file '{filepath}': {filehash}") ```

Validating Hashes

To ensure the integrity of a hashed item, use the validate or validate_file method to compare the computed hash with an existing hash.

```python

Validate a string hash

isvalid = hasher.validate(data, hashvalue) print(f"Is the hash valid? {is_valid}")

Validate a file hash

isfilevalid = hasher.validatefile(filepath, filehash) print(f"Is the file hash valid? {isfile_valid}") ```

Example Use Cases

  • Data Integrity Verification: Use this tool to verify if data has been altered by comparing the hash before and after.
  • Password Storage: Store passwords as salted and hashed strings for enhanced security.
  • File Change Detection: Monitor changes in files by hashing their content and comparing it with stored hash values.

Parameters

The following parameters can be configured in the ConfigurableHasher class:

  • rounds (int): Number of rounds to use in the hashing algorithm. Minimum is 64.
  • block_size (int): Size of the data blocks for hashing in bits, must be between 128 and 2048. Adjusted to be a multiple of 64.
  • hash_length (int): Length of the final hash output in bits, up to 512.
  • salt (Any): Optional salt for the hash. Accepts str, int, float, list, dict, tuple, and bytes. It is converted to bytes and truncated/padded to 16 bytes.
  • pepper (Any): Optional pepper for the hash. Accepts the same types as salt, converted to bytes and truncated/padded to 16 bytes.
  • output_format (str): Output format of the hash, either 'hex' or 'base64'.

Supported Data Types

The hash method accepts a variety of data types: - str: String data. - int: Integer data (signed and unsigned). - float: Floating-point numbers. - list: Lists containing any of the supported data types. - dict: Dictionaries with string keys and supported data types as values. - tuple: Tuples containing any of the supported data types. - bytes: Raw byte data.

Limitations

  • Integer Size: Integers are constrained by the block_size to prevent overflow errors. The maximum size is capped based on the block size in bits.
  • File Size: The maximum file size is limited by the available memory, as the file is processed in blocks equal to block_size // 8.

Security Considerations

The ConfigurableHasher offers a flexible and customizable hashing approach, but it's important to understand the security limitations: - This hashing implementation is not cryptographically secure compared to standard algorithms like SHA-256 or bcrypt. - Suitable for data integrity checks or non-critical hashing needs, but not recommended for highly sensitive information such as password hashing in a production environment. - Salting: The script allows for a fixed salt and pepper, making it easier to validate hashes but less secure than dynamic salting for each hash. Always use unique salts when possible for added security.


Owner

  • Name: Grey Team Toolbox
  • Login: GreyTeamToolbox
  • Kind: organization
  • Email: github@wolfsoftware.com

A collection of neutral security related tools. Created by Wolf Software.

Citation (CITATION.cff)

cff-version: 1.2.0
message: If you use this software, please cite it using these metadata.
title: Customizable hashing tool
abstract: Customizable hashing tool
type: software
version: 0.1.0
date-released: 2024-10-09
repository-code: https://github.com/GreyTeamToolbox/hasher-package
keywords:
  - "Wolf Software"
  - "Software"
license: MIT
authors:
  - family-names: "Wolf"
    orcid: "https://orcid.org/0009-0007-0983-2072"

GitHub Events

Total
  • Delete event: 59
  • Issue comment event: 82
  • Push event: 57
  • Pull request review event: 67
  • Pull request event: 121
  • Create event: 64
Last Year
  • Delete event: 59
  • Issue comment event: 82
  • Push event: 57
  • Pull request review event: 67
  • Pull request event: 121
  • Create event: 64

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 0
  • Total pull requests: 49
  • Average time to close issues: N/A
  • Average time to close pull requests: 4 days
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.02
  • Merged pull requests: 28
  • Bot issues: 0
  • Bot pull requests: 49
Past Year
  • Issues: 0
  • Pull requests: 49
  • Average time to close issues: N/A
  • Average time to close pull requests: 4 days
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.02
  • Merged pull requests: 28
  • Bot issues: 0
  • Bot pull requests: 49
Top Authors
Issue Authors
Pull Request Authors
  • dependabot[bot] (67)
Top Labels
Issue Labels
Pull Request Labels
dependabot: dependencies (67) dependabot: ecosystem : github actions (67) dependabot: auto approve (54) dependabot: manual merge (2)

Dependencies

.github/workflows/cicd.yml actions
  • ActionsToolbox/get-language-versions-action 446919617fd774095b5dd3ed71c39dd3fd0d8f4f composite
  • actions/checkout eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 composite
  • actions/setup-python f677139bbe7f9c59b41e40162b753c062f5d49a3 composite
.github/workflows/citation-validation.yml actions
  • ActionsToolbox/get-language-versions-action 446919617fd774095b5dd3ed71c39dd3fd0d8f4f composite
  • actions/checkout eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 composite
  • citation-file-format/cffconvert-github-action 4cf11baa70a673bfdf9dad0acc7ee33b3f4b6084 composite
  • ruby/setup-ruby f26937343756480a8cb3ae1f623b9c8d89ed6984 composite
.github/workflows/codeql.yml actions
  • Gamesight/slack-workflow-status 68bf00d0dbdbcb206c278399aa1ef6c14f74347a composite
  • actions/checkout eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 composite
  • github/codeql-action/analyze a57c67b89589d2d13d5ac85a9fc4679c7539f94c composite
  • github/codeql-action/autobuild a57c67b89589d2d13d5ac85a9fc4679c7539f94c composite
  • github/codeql-action/init a57c67b89589d2d13d5ac85a9fc4679c7539f94c composite
.github/workflows/delete-old-workflow-runs.yml actions
  • Gamesight/slack-workflow-status 68bf00d0dbdbcb206c278399aa1ef6c14f74347a composite
  • Mattraks/delete-workflow-runs 39f0bbed25d76b34de5594dceab824811479e5de composite
.github/workflows/dependabot.yml actions
  • dependabot/fetch-metadata dbb049abf0d677abbd7f7eee0375145b417fdd34 composite
.github/workflows/document-validation.yml actions
  • ActionsToolbox/get-language-versions-action 446919617fd774095b5dd3ed71c39dd3fd0d8f4f composite
  • actions/checkout eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 composite
  • actions/setup-node 0a44ba7841725637a19e28fa30b79a866c81b0a6 composite
  • ruby/setup-ruby f26937343756480a8cb3ae1f623b9c8d89ed6984 composite
.github/workflows/generate-release.yml actions
  • ActionsToolbox/get-language-versions-action 446919617fd774095b5dd3ed71c39dd3fd0d8f4f composite
  • Bullrich/generate-release-changelog 6b60f004b4bf12ff271603dc32dbd261965ad2f2 composite
  • actions/checkout eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 composite
  • actions/setup-python f677139bbe7f9c59b41e40162b753c062f5d49a3 composite
  • softprops/action-gh-release c062e08bd532815e2082a85e87e3ef29c3e6d191 composite
.github/workflows/generate-test-release.yml actions
  • ActionsToolbox/get-language-versions-action 446919617fd774095b5dd3ed71c39dd3fd0d8f4f composite
  • Bullrich/generate-release-changelog 6b60f004b4bf12ff271603dc32dbd261965ad2f2 composite
  • actions/checkout eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 composite
  • actions/setup-python f677139bbe7f9c59b41e40162b753c062f5d49a3 composite
  • softprops/action-gh-release c062e08bd532815e2082a85e87e3ef29c3e6d191 composite
.github/workflows/greetings.yml actions
  • actions/first-interaction 34f15e814fe48ac9312ccf29db4e74fa767cbab7 composite
.github/workflows/purge-deprecated-workflow-runs.yml actions
  • Gamesight/slack-workflow-status 68bf00d0dbdbcb206c278399aa1ef6c14f74347a composite
  • otto-de/purge-deprecated-workflow-runs 31a4e821d43e9a354cbd65845922c76e4b4b3633 composite
.github/workflows/repository-validation.yml actions
  • ActionsToolbox/get-language-versions-action 446919617fd774095b5dd3ed71c39dd3fd0d8f4f composite
  • actions/checkout eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 composite
  • actions/setup-go 0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 composite
  • actions/setup-python f677139bbe7f9c59b41e40162b753c062f5d49a3 composite
.github/workflows/security-hardening.yml actions
  • actions/checkout eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 composite
  • zgosalvez/github-actions-ensure-sha-pinned-actions ed00f72a3ca5b6eff8ad4d3ffdcacedb67a21db1 composite
.github/workflows/stale.yml actions
  • Gamesight/slack-workflow-status 68bf00d0dbdbcb206c278399aa1ef6c14f74347a composite
  • actions/stale 28ca1036281a5e5922ead5184a1bbf96e5fc984e composite