crystal
crystal copied to clipboard
Digest::Adler32 and Digest::CRC32 do not inherit from ::Digest
The ::Digest
abstract class represents an API for calculating/updating/finalizing digests (originally based off of Ruby's Digest::Base
class). However, Digest::Adler32
and Digest::CRC32
do not inherit from ::Digest
. However, OpenSSL::Digest
, Crystal::Digest::MD5
, Crystal::Digest::SHA1
do inherit from ::Digest
.
I feel like every type of digest algorithm under Digest::
should inherit from ::Digest
and implement it's API.
FTR This was discussed briefly in #8881
Changing the type from module to class is technically a breaking change. It would only break code where someone re-opened the stdlib type. I think that's acceptable.
I'm wondering if we should also deprecate the legacy API methods. They provide a different interface based on UInt32
(instead of generic Bytes
as in the Digest
API). Not sure if that's that much useful, but it probably doesn't hurt to keep it around.