INNER CODE UNIT · TypeScript
crossValidate
paulmillr/noble-ciphers · benchmark/_utils.ts:9
export async function crossValidate(title, labels, ciphers) {
// Verify that things we bench actually work; benchmark buffers derive from labels
const entries = labels.map((label) => [label, buf(parseSize(label))]);
const bufs = entries.map(([, data]) => data);
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