#ifndef SHA256_ARM_H #define SHA256_ARM_H #include // Ensure the ARM NEON headers are included if available #if defined(__ARM_NEON) || defined(_MSC_VER) || defined(__GNUC__) # include #endif // Function prototypes #ifdef __cplusplus extern "C" { #endif /** * @brief Resets the SHA256 state to initial values * * @param state Array of 8 uint32_t for maintaining state */ void sha256_init_arm(uint32_t state[8]); /** * Processes multiple blocks of data with the SHA-256 algorithm using ARMv8 SHA extensions. * The caller is responsible for setting the initial state and padding the final block. * * @param state The initial hash state (8 uint32_t elements). * @param data The input data to hash. * @param length The length of the input data in bytes. Must be a multiple of 64. */ void sha256_process_arm(uint32_t state[8], const uint8_t data[], uint32_t length); /** * Computes a double SHA-256 hash on given data using ARM architecture optimizations. The function first * hashes the input data, then hashes the result again. This method is commonly used in blockchain technologies. * * @param state Array of 8 uint32_t for the hash state, initialized prior to this call. * @param data Pointer to the data to be hashed. * @param len Length of the data in bytes. */ void sha256_double_arm(const uint8_t *input, size_t length, uint8_t hash[SHA256_BLOCK_SIZE]); void sha256_arm(const uint8_t *input, size_t length, uint8_t hash[SHA256_BLOCK_SIZE]); #ifdef __cplusplus } #endif #endif // SHA256_ARM_H