Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalizing sha256-functions #586

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

friedelschoen
Copy link

@friedelschoen friedelschoen commented Jan 23, 2024

Hey! I've resolved the deprecated SHA256_* functions with it's EVP_* functions. With that I've generic all xbps_file_sha256(...) functions to xbps_file_hash(XBPS_HASH_SHA256, ...) thus making support for other hashes in e.g. xbps-digest more easy.

  1. File Hashing Abstraction:

    • Introduces an enumeration xbps_hash_algorithm_t representing different hashing algorithms, including XBPS_HASH_SHA256 and XBPS_HASH_BLAKE2B256.
    • Adds functions xbps_hash_size_raw and xbps_hash_size to retrieve raw and hexstring hash sizes.
    • Implements xbps_file_hash_raw and xbps_file_hash to calculate raw and hexstring file hashes, respectively, based on the chosen algorithm.
  2. Code Refactoring:

    • Replaces instances of direct SHA256 calls with the new file hashing functions (xbps_file_hash_raw and xbps_file_hash) in various parts of the codebase.
    • Enhances the xbps_file_hash_check function to support different hashing algorithms.
  3. Support for Blake2b256:

    • Adjusts the existing codebase to use the new hash functions, ensuring compatibility with both SHA256 and Blake2b256.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant