allow only printable ASCII characters in flag strings

main
SI 2024-04-04 02:34:13 +02:00
parent 1eabc67732
commit 470a92264d
1 changed files with 2 additions and 0 deletions

View File

@ -30,6 +30,8 @@
return null; return null;
for (i in s) { for (i in s) {
var c = s.charCodeAt(i); var c = s.charCodeAt(i);
if (c < 32 || c > 126)
return null;
h += c.toString(16).padStart(2, "0"); h += c.toString(16).padStart(2, "0");
} }
return "0x" + new BN(keccak256(h).slice(2), 16).mod(secp256k1n).toString(16).padStart(64, 0); return "0x" + new BN(keccak256(h).slice(2), 16).mod(secp256k1n).toString(16).padStart(64, 0);