Function strHashToString

  • Hash a string into a buffer with a given algorithm

    Parameters

    • string: string

      The string to hash

    • algorithm: TCryptoAlgorithm = 'sha256'

      sha1 | sha256 | sha512 | md5 | etc...

    • encoding: Encoding = 'base64'

      base64 | base64url | hex | binary | utf8 | utf-8 | utf16le | latin1 | ascii | binary | ucs2 | ucs-2

    Returns string

    See

    crypto.getHashes for a list of accepted strings for 'algorithm'

    Example

    strHash.toString('hello', 'sha256', 'hex')
    //=> 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824

Generated using TypeDoc