Skip to main content

No project description provided

Project description

nashx

nashx is a simple yet efficient Python hashing library that allows users to generate hashes with customizable lengths. The package includes two distinct functions for hashing:

  • nashCore: A deterministic hashing function.
  • nashGuard: A salted hashing function that adds an extra layer of security.

Changes in Version 0.2

In version 0.2, we have introduced the following improvements:

  • nashCore: A deterministic version of the original hasher function, which generates consistent hashes for the same input.
  • nashGuard: A new salted hash function. This function adds complexity by incorporating a salt into the hashing process, making the hash more secure. The function also generates the salt if it is not provided.
  • Updated Function Names: The old hasher function has been replaced with nashCore for deterministic hashing and nashGuard for salted hashing.

Installation

You can install the nashx package via pip:

pip install nashx

Usage

1. nashCore (Deterministic Hashing)

The nashCore function generates a deterministic hash, meaning that the same input will always produce the same output hash.

from nashx import nashCore

data = "example"
hash_length = 16
hash_result = nashCore(data, hash_length)
print("Deterministic Hash:", hash_result)

2. nashGuard (Salted Hashing)

The nashGuard function generates a salted hash. If the salt is not provided, it will generate one internally. The function returns both the hash and the salt.

Example with generated salt:

from nashx import nashGuard

data = "example"
hash_length = 16

# If salt is not provided, nashGuard will generate one
hash_result, salt_used = nashGuard(data, hash_length)
print("Salted Hash:", hash_result)
print("Salt Used:", salt_used)

Example with custom salt:

salt = "your_preferred_salt_value"
hash_result, salt_used = nashGuard(data, hash_length, salt)
print("Salted Hash with Custom Salt:", hash_result)
print("Salt Used:", salt_used)

Function Explanation

nashCore(words, length)

  • Parameters:
    • words: The input string to be hashed.
    • length: The desired length of the generated hash.
  • Returns: A deterministic hash of the input string.

nashGuard(words, length, salt=None)

  • Parameters:
    • words: The input string to be hashed.
    • length: The desired length of the generated hash.
    • salt: The optional salt to be used in the hash. If not provided, the function will generate a random salt.
  • Returns: A tuple containing the salted hash and the salt used.

Example Output

Deterministic Hash:

Deterministic Hash: 8d40e2a833d2f67d

Salted Hash (salt is generated):

Salted Hash: 30a76f5f7585a6b9
Salt Used: f7a3e19b8cf6c2d7

Salted Hash (using provided salt):

Salted Hash with Custom Salt: 64b38c5f7b42cbb3
Salt Used: your_preferred_salt_value

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

nashx-0.2.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nashx-0.2-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file nashx-0.2.tar.gz.

File metadata

  • Download URL: nashx-0.2.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.0

File hashes

Hashes for nashx-0.2.tar.gz
Algorithm Hash digest
SHA256 2dd39352cdf012572862b97e0bf5c7b6b82e4c10c372686b1acb89bf4e5502e1
MD5 001c4eb7e6b0520157a5c35687c8192a
BLAKE2b-256 846e7c90196421424c6d2138250efa49b7791f393be185ac1b64e146f9746efd

See more details on using hashes here.

File details

Details for the file nashx-0.2-py3-none-any.whl.

File metadata

  • Download URL: nashx-0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.0

File hashes

Hashes for nashx-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 15a610fd3caaeeb044a1b05b18c89eadaafc2ed95b6101cce8b74fc40f077d2b
MD5 f8863f9c629da012d53b5077a2c72962
BLAKE2b-256 3a444fc1fd52e783b9e09b96759daf1a5e6bc092a01df966d781708c5117ec69

See more details on using hashes here.

Supported by

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