INNER CODE UNIT · TypeScript
bufMap
paulmillr/noble-ciphers · benchmark/_utils.ts:13
const bufMap = new Map(entries.map(([label, data]) => [data, label]));
// const bufs = Object.entries(buffers).map((entry) => entry[1][1])
// const bufs = [...Object.entries(buffers).map((i) => i[1][1])];
// Verify different buffer sizes
for (let i = 0; i < 2048; i++) bufs.push(buf(i));
// Verify different subarrays positions
// const b2 = buf(2048);
// for (let i = 0; i < 2048; i++) bufs.push(b2.subarray(i));
// Return encrypted values for buffers for decrypt test
const res = {};
for (const buf of bufs) {
const b = buf.slice();
// ciphers
let encrypted;
const opts = ciphers.options;
// Skip some buffers for block ciphers without padding
if (opts.blockSize && b.length % opts.blockSize) continue;