Skip to content

Conversation

@boorad
Copy link
Collaborator

@boorad boorad commented Aug 29, 2025

Problem

The createHash('KECCAK-256') function was failing with "Unknown hash algorithm" error on iOS, even though getHashes() listed KECCAK-256 as available. This was caused by a mismatch between the legacy OpenSSL API (EVP_get_digestbyname) used in createHash() and the provider-based API that enumerates available algorithms.

Solution

Added a dedicated keccak256() function that uses OpenSSL's modern provider-aware API (EVP_MD_fetch) to properly access KECCAK-256 digests. Also added unit test.

Future work

This could be extended to support all hash functions using the new OpenSSL API, but this satisfied my needs for my project. I might also add a PR to extend keccak256 support to the legacy 0.7.15 package because that is what everyone is using on npm (however as I understand it this would require upgrading the OpenSSL version on that package to 3.x)

replaces #745

@boorad boorad self-assigned this Aug 29, 2025
@boorad boorad changed the title Add native keccak256 hash function from OpenSSL 3.x feat: Add native keccak256 hash function from OpenSSL 3.x Aug 29, 2025
@boorad boorad merged commit 87f8e51 into main Aug 29, 2025
5 checks passed
@boorad boorad deleted the jds-thing branch August 29, 2025 13:38
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.

3 participants