-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs for verifying checksum manually #3913
Comments
here is the code that I found in electron-updater source, you can use this snippet to get the correct hash with base64 encoding. function hashFile(file, algorithm = "sha512", encoding = "base64", options) {
}); |
@lihai thanks a ton for this! Here's complete and ready to use code based on that to log the checksum: const path = require('path');
const fs = require('fs');
const crypto = require('crypto');
const YOUR_FILE_PATH = ''; // POPULATE THIS
function hashFile(file, algorithm = 'sha512', encoding = 'base64', options) {
return new Promise((resolve, reject) => {
const hash = crypto.createHash(algorithm);
hash.on('error', reject).setEncoding(encoding);
fs.createReadStream(
file,
Object.assign({}, options, {
highWaterMark: 1024 * 1024,
/* better to use more memory but hash faster */
})
)
.on('error', reject)
.on('end', () => {
hash.end();
console.log('hash done');
console.log(hash.read());
resolve(hash.read());
})
.pipe(
hash,
{
end: false,
}
);
});
}
const installerPath = path.resolve(
__dirname,
YOUR_FILE_PATH
);
hashFile(installerPath); |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
for google "how to extract sha512 from latest.yaml"
|
已解决 是我打包了同样的版本 过程通过#3913 (comment) 提供的脚本。 我发现打包后的软件 |
|
Electron Builder: ^20.39.0
Electron Updater: ^4.0.6
electron-builder build -c build/build-config.prod.yaml --win --ia32 --x64 -p always
There is already a closed issue 3119, which asks the same question but I don't understand how I can verify the checksum of an NSIS installer made by Electron-Builder manually.
If I have following checksum in latest.yml:
ZkkPBBqhX8vkq71iTcV+xvKyqcVCVVSpBDkQujDeMyzrp4tFCsW0KwTQBJXcJVuaxYyhCKNTA7t4RL0AhnyMrg==
And a NSIS installer myElectronInstaller.exe:
When I check the installer with OpenSSL:
openssl dgst -sha512 .\myElectronInstaller.exe
Or with Powershell:
Get-FileHash -Path .\resources\myElectronInstaller.exe -Algorithm SHA512
I will get a different result:
c4f0c2e3bb0add9f5ece7431901d7f09972661ec6e856c27c133be6a253223ed2b1ce4a1ac933383b7292547e6aec784286f31f183bba5762ad73fd99c299690
Is there any documentation how an user can verify the checksum? Or how Electron Auto Updater verifies the checksum after he has downloaded an update?
Thanks for helping me out.
The text was updated successfully, but these errors were encountered: