News for hackers. Stuff that matters.
Re:Evolving Scala by redcannon218 on Wednesday March 26, 2025 @11:31AM (#43483313)
I need to hash something, one way or another, in virtually 100% of my projects. Where is SHA-256 in the standard library?
Re:Evolving Scala by pkolaczk on Wednesday March 26, 2025 @11:48AM (#43483512)
cargo add sha256
Re:Evolving Scala by anta40 on Wednesday March 26, 2025 @12:30PM (#43483991)
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.

Re:Evolving Scala by pkolaczk on Wednesday March 26, 2025 @03:24PM (#43485988)
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.

Re:Evolving Scala by vaylian on Wednesday March 26, 2025 @05:22PM (#43487462)
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.