diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9a8bd87 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,87 @@ +# CONTRIBUTING + +## HOW TO INSTALL + +**You need:** + +- `Python=^3.8` +- `Poetry=^1.0.0` +- `Pre-commit=^3.0.0` + +**Install poetry** + +- [Read the documentation](https://python-poetry.org/docs/#installation) + +**Install dependencies** + +``` +poetry install --with dev +``` + +**Config pre-commit** + +```bash +pre-commit --version +pre-commit install +``` + +## HOW TO RUN TESTS + +``` +pytest -m "not benchmark" +``` + +## WORKFLOW + +1. Create your **proposal/bug** in an _issue_. +2. Create a new **branch** +3. Create a new **pull request**. + +--- + +## CONVENTIONAL COMMIT + +``` +type(escope): short description + +You need describe better? +Write more here +``` + +type + +- **add** adds a new feature +- **fix** fixes a bug +- **update** does not add a feature or fix a bug +- **remove** remove a peace of code +- **security** update/fix some security matter code + +--- + +## SEMANTIC VERSION + +Major.Minor.Patch (e.g. 1.3.4) + +- **deprecated!** -> _Major_ +- **add** -> _Minor_ +- **update | fix** -> _Patch_ + +--- + +## READTHEDOCS + +- [Development Inside a Container](https://code.visualstudio.com/docs/remote/containers#_getting-started) +- [Trunk Base Development](https://trunkbaseddevelopment.com) +- [Trunk Base Development](https://trunkbaseddevelopment.com) +- [Good Practices](https://bestpractices.coreinfrastructure.org/pt-BR) +- [Semantic Versioning](https://semver.org/lang/pt-BR/) +- [More about Versioning](http://www.modelcvs.org/versioning/) +- [Versioning Automate](https://bhuwanupadhyay.github.io/2020/04/applying-semantic-versioning-with-git-repository/) +- [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0-beta.2/#why-use-conventional-commits) +- [Default Angular Commit](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines) +- [Global hook for repositories](https://docs.gitlab.com/ce/administration/server_hooks.html#set-a-global-server-hook-for-all-repositories) +- [More about Commits](https://chris.beams.io/posts/git-commit/) +- [Quick Actions for Commits](https://docs.gitlab.com/ee/user/project/quick_actions.html) +- [Commits examples](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#) +- [Full Tutorial Add Convetional Commit as default](https://prahladyeri.com/blog/2019/06/how-to-enforce-conventional-commit-messages-using-git-hooks.html) +- [Create a global git commit hook](https://coderwall.com/p/jp7d5q/create-a-global-git-commit-hook) diff --git a/README.md b/README.md index eb6a9cf..b2ec026 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ Secure and easy-to-use keccak -> **✅ ready for production!!!** +> [!TIP] +> **17 MILLIONS TESTS PASSED** are validating this library, see [here]() ## Roadmap diff --git a/pyproject.toml b/pyproject.toml index e1daa48..2df1981 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "keccaky" -version = "0.3.1" +version = "0.4.0" description = "Secure and easy-to-use keccak" authors = ["Lucas Oliveira "] repository = "https://github.com/olivmath/keccaky.git" @@ -37,10 +37,10 @@ pytest-benchmark = "^4.0.0" pycryptodome = "^3.19.1" pre-commit = "^3.0.3" coverage = "^7.2.7" -pyclean = "^2.2.0" -pytest = "^7.2.1" +pyclean = "^3.0.0" +pytest = "^8.3.3" black = ">=23.1,<25.0" -tqdm = "^4.66.1" +tqdm = "^4.66.5" [build-system] requires = ["poetry-core>=1.0.0"] diff --git a/tests/keccaky/README.md b/tests/keccaky/README.md index 2c47262..aca130e 100644 --- a/tests/keccaky/README.md +++ b/tests/keccaky/README.md @@ -1,3 +1,25 @@ # Keccak 256 Know-Answer-Tests (KAT) Files downloaded on 2 January 2024 from https://keccak.team/obsolete/KeccakKAT-3.zip + +## Overview of Tests + +The tests in this directory are designed to validate the functionality and correctness of the Keccak hashing implementation provided by the `keccaky` library. The tests are structured to cover various scenarios, including short messages, long messages, and extremely long messages, ensuring comprehensive coverage of the hashing algorithm. + +### Test Files + +1. **test_check_state_file_KAT_256.py**: + - This test verifies the integrity of the hash states stored in a state file. It reads the initial message and its corresponding hash from the file, computes the hash using the Keccak algorithm, and checks for discrepancies. It also iterates through the hashes in the file to ensure that each subsequent hash is correctly derived from the previous one. + +2. **test_short_msg_KAT_256.py**: + - This test uses a set of known answer tests (KAT) for short messages. It reads the messages and their expected hashes from a file and asserts that the computed hash matches the expected value for each message. + +3. **test_long_msg_KAT_256.py**: + - Similar to the short message test, this file tests the hashing of longer messages. It reads the messages and their expected hashes from a separate file and performs assertions to ensure correctness. + +4. **test_extremely_long_loop_msg_KAT_256.py**: + - This test is designed to handle extremely long messages by processing them in a loop. It maintains a state file to keep track of the last processed message, allowing for resuming tests without starting over. The test verifies that the computed hash matches the expected hash after a specified number of iterations. + +### Running the Tests + +To run the tests, ensure you have `pytest` installed. You can execute the tests by running the following command in your terminal: