Function bitstrtobinstr

  • convert from hexadecimal string of ASN.1 BitString value with unused bit to binary string

    Parameters

    • h: string

      hexadecimal string of ASN.1 BitString value with unused bit

    Returns string | null

    binary string

    See

    Description

    This function converts from hexadecimal string of ASN.1 BitString value with unused bit to its integer value.
    When an improper hexadecimal string of BitString value is applied, this returns null.

    Example

    bitstrtobinstr("05a0") -> "101"
    bitstrtobinstr("0520") -> "001"
    bitstrtobinstr("07a080") -> "101000001"
    bitstrtobinstr(502) -> null // non ASN.1 BitString value
    bitstrtobinstr("ff00") -> null // for improper BitString value