Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace sha512

SHA-512, supporting hex, base64, crypt and HMAC hashes

preferred

Index

Functions

Const any

  • any(input: string, alphabet: string): string
  • Compute SHA-512 hash with custom alphabet

    Parameters

    • input: string

      Input string to be hashed

    • alphabet: string

      Custom alphabet to build result hash

    Returns string

Const anyHmac

  • anyHmac(key: string, data: string, alphabet: string): string
  • Compute SHA-512 hash with HMAC digest and custom alphabet

    Parameters

    • key: string

      HMAC key

    • data: string

      Input data to be hashed

    • alphabet: string

    Returns string

Const base64

  • base64(input: string): string
  • Compute SHA-512 hash with base64 output

    Parameters

    • input: string

      Input string to be hashed

    Returns string

Const base64Hmac

  • base64Hmac(key: string, data: string): string
  • Compute SHA-512 hash as base64 with HMAC digest

    Parameters

    • key: string

      HMAC key

    • data: string

      Input data to be hashed

    Returns string

Const crypt

  • crypt(input: string, salt: string): string
  • Compute SHA-512 hash compatible with crypt implementation (mkpasswd --method=sha-512)

    throws

    Error if input values validation fails

    Parameters

    • input: string

      Input string to be hashed

    • salt: string

      Salt to be used with algorithm. Salt length must be between 8 and 16 characters. Can contain magic prefix. Eg. param $6$rounds=1000$saltvalue Will use rounds decreased from default 5000 to 1000 and salt = saltvalue

    Returns string

Const hex

  • hex(input: string): string
  • Compute SHA-512 hash with hexadecimal output

    Parameters

    • input: string

      Input string to be hashed

    Returns string

Const hexHmac

  • hexHmac(key: string, data: string): string
  • Compute SHA-512 hash as hexadecimal with HMAC digest

    Parameters

    • key: string

      HMAC key

    • data: string

      Input data to be hashed

    Returns string

setBase64Padding

  • setBase64Padding(b64pad?: string): void
  • Set padding character for base64 output. Set = to be strictly compliant with RFC-4648. Default padding is empty string. This is global per-module option.

    Parameters

    • Optional b64pad: string

      Base64 padding character

    Returns void

setHexCase

  • setHexCase(uppercase?: boolean): void
  • Set HexCase for hex based methods. Default is false. This is global per-module option.

    Parameters

    • Optional uppercase: boolean

      true for uppercase output, false for lowercase output.

    Returns void

Generated using TypeDoc