INNER CODE UNIT · JavaScript
index
jofpin/temcrypt · temcrypt.js:231
const index = Math.floor(Math.log(bytes) / Math.log(kbytes));
const convertBytes = bytes / Math.pow(kbytes, index);
const formatBytes = convertBytes % 1 === 0 ? convertBytes.toFixed(0) : convertBytes.toFixed(2);
return `${formatBytes} ${units[index]}`;
};
return { sha256, enc256, dec256, splitKey, readerFile, writerFile, outputFilename, calculateBytes }
},
shuffle: function(value) {
if (!Array.isArray(value) && typeof value !== "string") {
throw new Error("The value must be a array or an string");
}
return Array.isArray(value) ? value.sort(() => Math.random() - 0.5).join("") : value.split("").sort(() => Math.random() - 0.5).join("");
},
shadowToken: function() {
const hash = this.helper().sha256(CryptoJS.lib.WordArray.random(256));