Hacker News new | ask | show | jobs
by redcannon218 449 days ago
I need to hash something, one way or another, in virtually 100% of my projects. Where is SHA-256 in the standard library?
3 comments

There is no sha-256 in the C or C++ standard library either. A cryptographic hashing algorithm like sha-256 is not something that necessarily has to be in a standard library.

There's plenty of old modules in the Python standard library that hardly any one uses. But removing them would break backwards compatibility guarantees. The Rust project has decided that they want to keep the standard library lean. And this works well in practise, because cargo is a really good package manager.

Rust standard library is minimalist (at least compared to Java/.NET), so no SHA-266.

If you want a more useful standard library, perhaps consider Go.

It is minimalist because it has to support many platforms and must be lightweight and easy to port. It also must be stable for a long time. Once something lands in the standard library, it is very hard to remove / modify / redesign. How many half-broken date time implementations Java ended up with?

But it makes up for the minimalist stdlib by making it a breeze to use third-party libraries.

cargo add sha256