const input = await Deno.readTextFile("input.txt"); const inputs = input.split(","); function hash(s: string){ let ret = 0; for (let i = 0; i < s.length; i++) { const ch = s.charCodeAt(i); ret += ch; ret *= 17; ret %= 256; } return ret; } console.log(hash("HASH"), 52); // console.log(inputs.map(x=> hash(x))) console.log(inputs.map(x=> hash(x)).reduce((a, b) => a + b, 0));