actions-hugo
actions-hugo copied to clipboard
feat: Validate checksum
async function sha256(str) {
// Convert string to ArrayBuffer
const buff = new Uint8Array([].map.call(str, (c) => c.charCodeAt(0))).buffer;
// Calculate digest
const digest = await crypto.subtle.digest('SHA-256', buff);
// Convert ArrayBuffer to hex string
// (from: https://stackoverflow.com/a/40031979)
return [].map.call(new Uint8Array(digest), x => ('00' + x.toString(16)).slice(-2)).join('');
}
(async () => {
const digest = await sha256("hello");
// 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
})();
SHA256のハッシュをJavaScriptのWeb標準のライブラリだけで計算する - nwtgck / Ryo Ota
wget "https://github.com/gohugoio/hugo/releases/download/v0.58.3/hugo_0.58.3_checksums.txt"
wget "https://github.com/gohugoio/hugo/releases/download/v0.58.3/hugo_0.58.3_macOS-64bit.tar.gz"
grep "hugo_0.58.3_macOS-64bit.tar.gz" "hugo_0.58.3_checksums.txt" | sha256sum --check -
- ubuntu, macos:
| shasum -a 256 --check - windows:
certutil -hashfile file SHA256
This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days.