-
Notifications
You must be signed in to change notification settings - Fork 19
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
Keccak256 and secp256k1 Support #117
Comments
I think the keccak version in openssl is sha3. If your bindings are built against libcrypto 3.0 or higher this should work: openssl:::rawstringhash('foo', 'sha3-256', NULL) There is currently no R wrapper, but you can easily add one similar to sha2: Lines 82 to 86 in 9eb04f6
|
openssl:::rawstringhash('foo', 'sha3-256', NULL)
[1] "76d3bc41c9f588f7fcd0d5bf4718f8f84b1c41b20882703100b9eb9413807c01" but keccak256 is:
I believe keccak support was included in openssl here openssl/openssl#16594 |
When calling
would return NULL but using
So despite the fact that something like this works
it seems that particular algorithm still can't be used inside R because tested with |
@jeroen is there a fix to make Some background: keccak-256 is sha3-256 in the sense that the keccak team won the NIST hash function competition in 2012 and published FIPS 202, which became the official SHA-3 standard in 2015. FIPS 202 contained some tweaks not in the team's original implementation, so we're left with keccak-256 and (standard) sha3-256, and both are widely used. |
@rmsams Apparently the secretbase package supports the algorithm if you need a solution now. |
I wasn't aware, thank's for the reference @MrFlick |
Thanks, I've tried to add it here to based on #117 (comment) |
Hmm it looks like keccak is only available on openssl 3.2 and up... |
OK I have released this on CRAN. So you can use |
That was fast, thanks @jeroen !
Yes, that's a shame b/c it will take some time before libssl-dev >=3.2 makes it into the LTS releases of most linux distros. I suppose you could not export |
This is why I am generally a bit reluctant to add this. Also this algorithm is not available on systems with alternative openssl implementations such as libressl. So you can use it locally on Windows and Mac, but if you want to write portable software that may be used by other people, I would recommend to stick with some of the more standard algorithms. |
Sure, I get it. But keccak is a primitive in most blockchain protocols so as far as sha3 implementation are concerned, it's here to stay and will propagate into most openssl implementations over time. Until that day arrives, maybe you can just keep |
Is it possible to add support for keccak256 and secp256k1? I haven't found good viable options for these 2 within R.
Thanks
The text was updated successfully, but these errors were encountered: