Skip to content
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

Implement Digest::SHA256 #5197

Closed
wants to merge 1 commit into from
Closed

Conversation

lbguilherme
Copy link
Contributor

Currently Crystal only provides MD5 and SHA1 digests, which are both kind of deprecated and not recommended. Sure it is possible to use OpenSSL::Digest, but this pulls one big dependency for something that should be simple.

This pull request adds SHA256 to the game. The implementation could surely be more optimized, but this isn't the focus now, it can be improved later.

More algorithms could be implemented later, such as all variations of SHA-2 and SHA-3.

@asterite
Copy link
Member

Déjà vu: #2815

@lbguilherme
Copy link
Contributor Author

😮 😞

@RX14
Copy link
Contributor

RX14 commented Oct 28, 2017

I'd rather not merge new crypto/openssl APIs before we think about redesigning the stdlib's crypto API in general. I think there should be a Digest module which picks between openssl/other libraries/crystal at compile time, and the same for TLS and HMAC too. It's weird having Digest and OpenSSL::Digest. We shouldn't have a module called OpenSSL, we should decide exactly which crypto primitives we should expose and support switchable implementations of them. We know that openssl isn't perfect, we definitely shouldn't design the stdlib around it.

@straight-shoota straight-shoota added kind:feature topic:stdlib:crypto pr:needs-work A PR requires modifications by the author. labels Jan 23, 2021
straight-shoota pushed a commit that referenced this pull request Jun 17, 2021
* Add OpenSSL::SSL::Socket#peer_certificate
* Add OpenSSL::X509::Certificate#signature_name and #5197 
* Wrap OpenSSL linked functions in version guards
* Update wording on OpenSSL::X509::Certificate#signature_algorithm error message
@lbguilherme lbguilherme closed this Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:feature pr:needs-work A PR requires modifications by the author. topic:stdlib:crypto
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants