Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "BinaryUtils"

Index

Functions

Let bigIntegerNumberToBinaryString

  • bigIntegerNumberToBinaryString(num: BigInteger): string
  • Converts a given BigInteger number to a binary string

    Parameters

    • num: BigInteger

      the BigInteger number

    Returns string

    the binary string

Let cidrPrefixToMaskBinaryString

  • cidrPrefixToMaskBinaryString(cidrPrefix: number, ipType: IPv4 | IPv6): string
  • Given the prefix portion of a cidr notation and the type of IP number, returns the mask in binary string

    Parameters

    • cidrPrefix: number

      the prefix part of a cidr notation

    • ipType: IPv4 | IPv6

      the type of the ip number in the range the cidr represents

    Returns string

Let decimalNumberToBinaryString

  • decimalNumberToBinaryString(num: number): string
  • Converts a decimal number to binary string

    Parameters

    • num: number

      number to parse

    Returns string

    the binary string representation of number

Let decimalNumberToOctetString

  • decimalNumberToOctetString(num: number): string
  • Converts a decimal number to binary octet (8 bit) string. If needed the octet will be padded with zeros to make it up to 8 bits

    Parameters

    • num: number

      to convert to octet string

    Returns string

    the octet string representation of given number

Let dottedDecimalNotationToBinaryString

  • dottedDecimalNotationToBinaryString(dottedDecimal: string): string
  • Given an IPv4 number in dot-decimal notated string, e.g 192.168.0.1 converts it to binary string, e.g. '11000000101010000000000000000001'

    Parameters

    • dottedDecimal: string

      IPv4 string in dot-decimal notation

    Returns string

    the binary value of the given ipv4 number in string

Let intLog2

  • intLog2(givenNumber: BigInteger): number
  • Calculates the log, to base 2 of given number.

    Parameters

    • givenNumber: BigInteger

      the number to calculate log base 2

    Returns number

    the log base 2 of given number

Let leftPadWithZeroBit

  • leftPadWithZeroBit(binaryString: string, finalStringLength: number): string
  • Given a binary string, adds a number of zero to the left until string is as long as the given string length

    Parameters

    • binaryString: string

      the string to pad

    • finalStringLength: number

      the final length of string after padding

    Returns string

Let parseBinaryStringToBigInteger

  • parseBinaryStringToBigInteger(num: string): BigInteger
  • Parses number in binary to number in BigInteger

    Parameters

    • num: string

      binary number in string to parse

    Returns BigInteger

    binary number in BigInteger

Generated using TypeDoc