aws-crt
Version:
NodeJS/browser bindings to the aws-c-* libraries
105 lines (104 loc) • 3.22 kB
TypeScript
import { Hashable } from "../common/crypto";
export { Hashable } from "../common/crypto";
declare class BaseHash {
private hasher;
constructor(hasher: any);
/**
* Hashes additional data
* @param data Additional data to hash
*/
update(data: Hashable): void;
/**
* Completes the hash computation and returns the final hash digest.
*
* @param truncate_to The maximum number of bytes to receive. Leave as undefined or 0 to receive the entire digest.
*
* @returns the final hash digest
*/
finalize(truncate_to?: number): DataView;
}
/**
* Object that allows for continuous MD5 hashing of data.
*
* @category Crypto
*/
export declare class Md5Hash extends BaseHash {
constructor();
}
/**
* 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.
*
* @returns the data's hash digest
*
* @category Crypto
*/
export declare function hash_md5(data: Hashable, truncate_to?: number): DataView;
/**
* Object that allows for continuous SHA256 hashing of data.
*
* @category Crypto
*/
export declare class Sha256Hash extends BaseHash {
constructor();
}
/**
* 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.
*
* @returns the data's hash digest
*
* @category Crypto
*/
export declare function hash_sha256(data: Hashable, truncate_to?: number): DataView;
/**
* Object that allows for continuous SHA1 hashing of data.
*
* @category Crypto
*/
export declare class Sha1Hash extends BaseHash {
constructor();
}
/**
* Computes an SHA1 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.
*
* @returns the data's hash digest
*
* @category Crypto
*/
export declare function hash_sha1(data: Hashable, truncate_to?: number): DataView;
/**
* Object that allows for continuous hashing of data with an hmac secret.
*
* @category Crypto
*/
export declare class Sha256Hmac extends BaseHash {
/**
* Constructor for the Sha256Hmac class type
* @param secret secret key to seed the hmac process with
*/
constructor(secret: Hashable);
}
/**
* 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.
*
* @returns the data's hmac digest
*
* @category Crypto
*/
export declare function hmac_sha256(secret: Hashable, data: Hashable, truncate_to?: number): DataView;