mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
Removed padLeft and padRight in favour of String.prototype.padStart and padEnd. 'To Hex' now supports ArrayBuffers.
This commit is contained in:
parent
e18ec5f2b2
commit
849d41ee56
15 changed files with 77 additions and 104 deletions
|
@ -31,13 +31,13 @@ const ByteRepr = {
|
|||
/**
|
||||
* To Hex operation.
|
||||
*
|
||||
* @param {byteArray} input
|
||||
* @param {ArrayBuffer} input
|
||||
* @param {Object[]} args
|
||||
* @returns {string}
|
||||
*/
|
||||
runToHex: function(input, args) {
|
||||
const delim = Utils.charRep[args[0] || "Space"];
|
||||
return Utils.toHex(input, delim, 2);
|
||||
return Utils.toHex(new Uint8Array(input), delim, 2);
|
||||
},
|
||||
|
||||
|
||||
|
@ -266,7 +266,7 @@ const ByteRepr = {
|
|||
padding = 8;
|
||||
|
||||
for (let i = 0; i < input.length; i++) {
|
||||
output += Utils.pad(input[i].toString(2), padding) + delim;
|
||||
output += input[i].toString(2).padStart(padding, "0") + delim;
|
||||
}
|
||||
|
||||
if (delim.length) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue