std.crypto
Types
interface Aead
struct AeadError
interface Algorithm
interface AssociatedOid
interface BlockCipher
enum BlockPadding
interface Hash
struct InvalidLengthError
struct ObjectIdentifier
struct PadError
struct ParseOidError
struct Pkcs1Error
struct Pkcs8Error
struct SpkiError
struct UnpadError
Functions
_create_native_hash
pub fn _create_native_hash(hash: Hash): NativeHash
[src]
pub fn _create_native_hash(hash: Hash): NativeHash {
return NativeHash
.new(
hash.block_size(),
hash.output_size(),
|| hash.name(),
|| hash.reset(),
|buf| hash.update(buf),
|| hash.digest()
);
}
_create_native_hash
pub fn _create_native_hash(hash: Hash): NativeHash
[src]
pub fn _create_native_hash(hash: Hash): NativeHash {
return NativeHash
.new(
hash.block_size(),
hash.output_size(),
|| hash.name(),
|| hash.reset(),
|buf| hash.update(buf),
|| hash.digest()
);
}
[src]
pub fn hash<T: Hash>(data: Bytes): Bytes {
let digest = T.new();
digest.update(data);
return digest.digest();
}
Hashes the given data using the given hash function.
[src]
pub fn hash<T: Hash>(data: Bytes): Bytes {
let digest = T.new();
digest.update(data);
return digest.digest();
}
Hashes the given data using the given hash function.
Hashes the given data using the given hash function.
Example
navi
use std.crypto.{hash, sha2.Sha256};
let data = "hello".bytes();
let hash = hash::<Sha256>(data);