Hash2603 is a versatile cryptographic hash function with variable output lengths and rounds. It can be used to generate hash codes for various purposes, including securing passwords and verifying sensitive information.
To use Hash2603 to generate hash codes, follow these steps:
-
Import the
Hash2603class from thehash2603module.from hash2603 import Hash2603
-
Create a
Hash2603object by providing the input data, which can be a file name, bytes, or text.hash_obj = Hash2603("HERE WILL BE FILE NAME OR BYTES OR TEXTS")
-
Define the desired hash length and round. The hash length is specified using the
Bnnotation, wherenis the desired length in bits (e.g.,B128for a 128-bit hash). The round is specified using theURnnotation, wherenis the desired round (e.g.,UR4for 4 rounds). -
Call the corresponding hash function to obtain the hash code.
hash_value = hash_obj.UR4hash128() # Example: UR4 means 4 rounds and hash128 means 128-bit output
-
Repeat step 4 with different hash lengths and rounds as needed.
Hash2603 supports various hash lengths (B0, B1, B2, B4, B8, B16, B32, B64, B128, B256, B512, B1024) and rounds (UR1 to UR10). Here's a quick reference:
B0toB128can be obtained fromUR1toUR10.B256can be obtained fromUR2toUR10.B512can be obtained fromUR4toUR10.B1024can be obtained fromUR9toUR10.
Below is an example of generating hash codes for different hash lengths and rounds:
# For quick check run test.py
from hash2603 import Hash2603
hash_obj = Hash2603("HERE WILL BE FILE NAME OR BYTES OR TEXTS")
# Example hash generation for different lengths and rounds
UR1hash0 = hash_obj.UR1hash0()
UR2hash0 = hash_obj.UR2hash0()
# ...
# Print hash values
print("UR1hash0:", UR1hash0)
print("UR2hash0:", UR2hash0)
# ...
# Repeat the process for other hash lengths and roundsHash2603 is designed for lightweight cryptographic applications, such as hashing small files, text, or securing passwords. For more security-sensitive applications, consider using Hash2600, a more advanced version of this hash function.
Feel free to explore and use Hash2603 for your cryptographic needs! If you encounter any issues or have suggestions for improvement, please don't hesitate to report them on GitHub.
