MCPcopy
hub / github.com/gchq/CyberChef / bin

Method bin

src/core/Utils.mjs:164–167  ·  view source on GitHub ↗

* Converts a character or number to its binary representation. * * @param {char|number} c * @param {number} [length=8] - The width of the resulting binary number. * @returns {string} * * @example * // returns "01101110" * Utils.bin("n"); * * // retur

(c, length=8)

Source from the content-addressed store, hash-verified

162 * Utils.bin(110);
163 */
164 static bin(c, length=8) {
165 c = typeof c == "string" ? Utils.ord(c) : c;
166 return c.toString(2).padStart(length, "0");
167 }
168
169
170 /**

Callers 6

runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
elfHeaderMethod · 0.80
runMethod · 0.80

Calls 2

ordMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected