digest icon indicating copy to clipboard operation
digest copied to clipboard

Add SHA3?

Open mperham opened this issue 1 year ago • 3 comments

Would you be ok with a PR adding SHA3? I'd integrate the code here:

https://github.com/mjosaarinen/tiny_sha3

which is MIT-licensed. The C code is a single, short file and has the init/update/finalize API that all Digests seem to use.

There are two existing rubygems which provide SHA3 but the C code is more complex.

https://github.com/phusion/digest-sha3-ruby https://github.com/johanns/sha3

See also #10

mperham avatar Sep 04 '24 03:09 mperham

tiny_sha3 seems not portable.

This looks assuming gcc only.

#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__

nobu avatar Sep 06 '24 07:09 nobu

Be careful with naming. What some people call SHA3 is actually a draft version of it, now known as Keccak. It's what Ethereum uses AFAIR. Final SHA3 is different. Maybe they both may be implemented under their proper names.

kotovalexarian avatar Sep 09 '25 14:09 kotovalexarian

There is my fork of SHA3 by Phusion, properly renamed to Keccak and fixed for Ruby 3.4: https://github.com/kotovalexarian/digest-keccak

kotovalexarian avatar Sep 09 '25 15:09 kotovalexarian