Sha1
Computes a SHA-1 digest.
Module: Std::Hash::Sha1
Signature
rux
func Hash(message: char8[]) -> String;
func HashSha0(message: char8[]) -> String;Parameters
| Name | Type | Description |
|---|---|---|
message | char8[] | The data to hash. |
Returns
String — the 20-byte (160-bit) digest as a 40-character lowercase hex string.
Description
SHA-1 produces a 160-bit digest. Call it as Sha1::Hash(...). The module also exposes HashSha0, which computes the older SHA-0 variant (SHA-1 without the message-schedule rotation).
WARNING
SHA-1 is cryptographically broken — practical collisions exist. Use it only for compatibility with legacy systems, never for new security work. Prefer Sha256, Blake2, or Blake3.
Example
rux
import Std::Hash::Sha1;
import Std::Io::PrintLine;
func Main() -> int {
PrintLine(Sha1::Hash("hello"));
// aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d
return 0;
}