MD5 计算

// 使用示例
const data = {
name: 'John Doe',
email: 'john.doe@example.com'
};
const jsonString = JSON.stringify(data);
const hash1 = md5Dtr(jsonString);
const hash2 = md5(data);
const hash3 = Md5.hashStr(data);
console.log('MD5 Hash:', hash1,hash2,hash3);

Constructors

Methods

  • Append an ASCII string to the hash buffer

    Parameters

    • str: string

      String to append

    Returns Md5

  • Append a byte array to the hash buffer

    Parameters

    • input: Uint8Array

      array to append

    Returns Md5

  • Append a UTF-8 string to the hash buffer

    Parameters

    • str: string

      String to append

    Returns Md5

  • Hash the current state of the hash buffer and return the result

    Parameters

    • raw: boolean = false

      Whether to return the value as an Int32Array

    Returns string | Int32Array

  • Get the state of the hash buffer

    Returns HasherState

  • Override the current state of the hash buffer

    Parameters

    • state: HasherState

      New hash buffer state

    Returns void

  • Hash a ASCII string on the spot

    Parameters

    • str: string

      String to hash

    • Optionalraw: false

      Whether to return the value as an Int32Array

    Returns string

  • Parameters

    • str: string
    • raw: true

    Returns Int32Array

  • Hash a UTF-8 string on the spot

    Parameters

    • str: string

      String to hash

    • Optionalraw: false

      Whether to return the value as an Int32Array

    Returns string

  • Parameters

    • str: string
    • raw: true

    Returns Int32Array