3 ms·
I need to hash something, one way or another, in virtually 100% of my projects. Where is SHA-256 in the standard library?
by redcannon218 2y ago
I need to hash something, one way or another, in virtually 100% of my projects. Where is SHA-256 in the standard library?
- pkolaczk 2y agocargo add sha256
- anta40 2y agoRust 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.
- pkolaczk 2y agoIt 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.
- vaylian 2y agoThere 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.