Function binstrtobitstr

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

    Parameters

    • s: string

      binary string (ex. "101")

    Returns null | string

    hexadecimal string of ASN.1 BitString value with unused bit

    See

    bitstrtobinstr

    Description

    This function converts from an binary string (ex. "101") to hexadecimal string of ASN.1 BitString value with unused bit (ex. "05a0").
    When "s" is not binary string, this returns null.

    Example

    binstrtobitstr("101") -> "05a0"
    binstrtobitstr("001") -> "0520"
    binstrtobitstr("11001") -> "03c8"
    binstrtobitstr("101000001") -> "07a080"
    binstrtobitstr(101) -> null // not number
    binstrtobitstr("xyz") -> null // not binary string