crystal icon indicating copy to clipboard operation
crystal copied to clipboard

Digest::Adler32 and Digest::CRC32 do not inherit from ::Digest

Open postmodern opened this issue 3 years ago • 2 comments

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.

postmodern avatar Jan 30 '21 22:01 postmodern

FTR This was discussed briefly in #8881

bcardiff avatar Jan 31 '21 00:01 bcardiff

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.

straight-shoota avatar Jul 29 '22 10:07 straight-shoota