@ivujs/i-utils
Version:
前端模块化 JavaScript 工具库
12 lines (11 loc) • 400 B
TypeScript
/**
* Calculates MD5 value for a given string.
* If a key is provided, calculates the HMAC-MD5 value.
* Returns a Hex encoded string unless the raw argument is given.
*
* @param {string} string Input string
* @param {string} [key] HMAC key
* @param {boolean} [raw] Raw output switch
* @returns {string} MD5 output
*/
export function md5(string: string, key?: string, raw?: boolean): string;