OxL Справочник OxL
РусскийEnglish

data sha2

SHA-2 digests: sha2.sha256(data) is 32 bytes, sha384 48, sha512 64.

Example:

oxl✓ проверяется в CI
use std.crypto { sha2 }
use std.ser { bytesOf, hex }

fn main() io {
  print(hex(&sha2.sha256(bytesOf(&"abc"))))
}
Вывод
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
pub(api) data sha2

Потокобезопасность. pure functions; safe from any task.

С версии. 1.0.0-beta

Методы

sha256(input: bytes) -> bytes
The SHA-256 digest of input (32 bytes).
sha384(input: bytes) -> bytes
The SHA-384 digest of input (48 bytes).
sha512(input: bytes) -> bytes
The SHA-512 digest of input (64 bytes).

Определено в: std/crypto/crypto.oxl:83

См. также