Hello,
for my little crypto-lite gem / library project [1] I am trying to
include the keccak-256 hash function (used by ethereum, for example).
Any tips or recommendations more than welcome.
Thanks. Cheers. Prosit 2021!
[1] https://github.com/rubycoco/blockchain/tree/master/crypto-lite
Hello,
GitHub - johanns/sha3: SHA3 for Ruby is a XKCP based native (C) binding to SHA3 (FIPS 202) cryptographic hashing algorithm
thanks for highlighting the sha3 gem.
Sorry for the confusion I am looking for the "original" keccak
hashing algorithm
as used by Ethereum and others.
To quote:
NIST changed the padding to SHA3-256(M) = KECCAK [512] (M || 01, 256).
This was different from the padding proposed by the Keccak team in
The Keccak SHA-3 submission version 3 (final, winning version).
The difference is the additional '01' bits appended to the message.
People are now calling the "submitted version 3" SHA-3 Keccak hashing "Keccak"
and the finalized NIST SHA-3 standard "SHA-3".
I tried the sha3 gem:
require 'sha3'
p SHA3::Digest::SHA256.hexdigest("")
p SHA3::Digest::SHA256.hexdigest("testing")
resulting in:
"a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a"
"7f5979fb78f082e8b1c676635db8795c4ac6faba03525fb708cb5fd68fd40c5e"
but I would expect:
"c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
"5f16f4c7f149ac4f9510d9cf8cf384038ad348b3bcdc01915f95de12df9d1b02"
So sorry the sha3 gem is a FIPS 202 compliant implementation of SHA3
that I can unfortunately not use in this case.
Any other tips or recommendations more than welcome.
Cheers. Prost.