feat: publish Regex Tools 0.1.0
This commit is contained in:
12
scripts/checksum-release.mjs
Normal file
12
scripts/checksum-release.mjs
Normal file
@@ -0,0 +1,12 @@
|
||||
import { createHash } from "node:crypto";
|
||||
|
||||
export function sha256(data) {
|
||||
return createHash("sha256").update(data).digest("hex");
|
||||
}
|
||||
|
||||
export function checksumLine(digest, fileName) {
|
||||
if (!/^[a-f0-9]{64}$/u.test(digest) || /[\/\r\n]/u.test(fileName)) {
|
||||
throw new Error("Invalid checksum output");
|
||||
}
|
||||
return `${digest} ${fileName}\n`;
|
||||
}
|
||||
Reference in New Issue
Block a user