UNPKG

aws-crt

Version:

NodeJS/browser bindings to the aws-c-* libraries

141 lines (140 loc) 4.38 kB
import { Hashable } from "../common/crypto"; export { Hashable } from "../common/crypto"; /** * Object that allows for continuous MD5 hashing of data. * * @category Crypto */ export declare class Md5Hash { private hash?; /** * 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; } /** * 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 { private hash?; /** * 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; } /** * 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 { private hash?; /** * 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; } /** * 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 { private hmac; /** * Constructor for the Sha256Hmac class type * @param secret secret key to seed the hmac process with */ constructor(secret: Hashable); /** * Hashes additional data * @param data Additional data to hash */ update(data: Hashable): void; /** * Completes the hash computation and returns the final hmac digest. * * @param truncate_to The maximum number of bytes to receive. Leave as undefined or 0 to receive the entire digest. * * @returns the final hmac digest */ 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. * * @returns the data's hmac digest * * @category Crypto */ export declare function hmac_sha256(secret: Hashable, data: Hashable, truncate_to?: number): DataView;