// SPDX-License-Identifier: Apache-2.0
// Copyright 2015-2022 The Apache Software Foundation.
//
// Token-generation helpers — extracted from an Apache-2.0 utility module.
// DEMO FIXTURE — line 8 uses Math.random for token bytes (weak RNG, CWE-330).
function makeToken() {
return Math.random().toString(36).slice(2, 12);
}
function shortHash(input) {
let h = 0;
for (let i = 0; i < input.length; i++) h = ((h << 5) - h + input.charCodeAt(i)) | 0;
return h.toString(16);
}
module.exports = { makeToken, shortHash };