array of name string
associative array of name and value
binary string (ex. "110001")
This function converts from an array of names to a binary string. DB value bit will be set. Note that ordering of namearray items will be ignored. This function may be useful to implement ASN.1 BitString such as KeyUsage.
const db: Record<string, number> = { a: 0, b: 3, c: 8, d: 9, e: 17, f: 19 };
namearraytobinstr(['a', 'c', 'd'], db) -> '1000000011'
namearraytobinstr(['c', 'b'], db) -> '000100001'
convert array of names to bit string