@n3okill/utils
Version:
Many javascript helpers
10 lines (9 loc) • 425 B
TypeScript
/**
* Prefixes data with a keyed hash value so that it can later be detected if it is tampered.
* @param data Data to be protected
* @param key Secret key to be used for generating hash
* @param algorithm Hashing algorithm (e.g. "md5", "sha1", "sha256", etc.)
* @return Data prefixed with the keyed hash
* @see validateData()
*/
export declare function hashData(data: string, key: string, algorithm?: string): string;