Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of Changes
This pull request implements the AsconHash algorithm along with the necessary cryptographic exceptions and utility functions. The changes are structured as follows:
1. AsconHash Algorithm:
AsconHash
andAsconHashA
.Update
.DoFinal
.Reset
.2. Cryptographic Exceptions:
CryptoException
: A base exception for cryptographic errors.DataLengthException
: Thrown when the input data length is invalid for processing.OutputLengthException
: Thrown when the output buffer is too short for the resulting data.3. Utility Classes:
ByteEncodingUtils
:ValidationUtils
:DataLengthException
orOutputLengthException
) when validation fails.Cross-Examination of Hash Values
To ensure the accuracy and correctness of the implemented AsconHash algorithm, the resulting hash values from this implementation have been cross-examined against values generated by trusted and vetted cryptographic libraries, including Bouncy Castle. The hashes were verified to match exactly for identical input data, ensuring that this implementation is in line with established cryptographic standards and is fully compatible with the Ascon specifications.
How Ascon Algorithm Works
Ascon is a lightweight cryptographic algorithm designed to provide secure hashing and authenticated encryption. It is particularly optimized for constrained environments such as IoT devices and embedded systems. Ascon utilizes a sponge construction, which processes data in two phases:
The security of Ascon comes from its permutation function (
P
), which performs several rounds of bitwise operations, rotations, and mixing using round constants to ensure cryptographic strength.Context and Use Cases
Ascon was a finalist in the CAESAR competition and has since been standardized as part of the ISO/IEC 29192-6 standard for lightweight cryptography. Its design is focused on efficiency, making it ideal for:
IoT Devices: These devices often have limited processing power and memory, where Ascon’s lightweight operations are highly beneficial.
Embedded Systems: With minimal computational overhead, Ascon can be implemented in hardware or software for secure data processing.
Secure Communications: Ascon is suitable for hashing and encryption in protocols ensuring data integrity, such as message authentication.
I have performed a self-review of my code
My code follows the style guidelines of this project
I have added tests that prove my fix is effective or that my feature works
New and existing unit tests pass locally with my changes
Comments in areas I changed are up to date
I have added comments to hard-to-understand areas of my code
I have made corresponding changes to the README.md