aws-crt
Version:
NodeJS bindings to the aws-c-* libraries
43 lines (42 loc) • 1.68 kB
TypeScript
import { Hashable } from "../common/crypto";
export declare class Md5Hash {
private hash?;
update(data: Hashable): void;
finalize(truncate_to?: number): DataView;
}
/**
* Computes an MD5 hash. Use this if you don't need to stream the data you're hashing and can load the entire input
* into memory.
*
* @param data The data to hash
* @param truncate_to The maximum number of bytes to receive. Leave as undefined or 0 to receive the entire digest.
*/
export declare function hash_md5(data: Hashable, truncate_to?: number): DataView;
export declare class Sha256Hash {
private hash?;
update(data: Hashable): void;
finalize(truncate_to?: number): DataView;
}
/**
* Computes an SHA256 hash. Use this if you don't need to stream the data you're hashing and can load the entire input
* into memory.
*
* @param data The data to hash
* @param truncate_to The maximum number of bytes to receive. Leave as undefined or 0 to receive the entire digest.
*/
export declare function hash_sha256(data: Hashable, truncate_to?: number): DataView;
export declare class Sha256Hmac {
private hmac;
constructor(secret: Hashable);
update(data: Hashable): void;
finalize(truncate_to?: number): DataView;
}
/**
* Computes an SHA256 HMAC. Use this if you don't need to stream the data you're hashing and can load the entire input
* into memory.
*
* @param secret The key to use for the HMAC process
* @param data The data to hash
* @param truncate_to The maximum number of bytes to receive. Leave as undefined or 0 to receive the entire digest.
*/
export declare function hmac_sha256(secret: Hashable, data: Hashable, truncate_to?: number): DataView;