Skip to content
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

SHA512 do not match #69

Closed
hbarsaiyan opened this issue Nov 29, 2020 · 3 comments
Closed

SHA512 do not match #69

hbarsaiyan opened this issue Nov 29, 2020 · 3 comments
Labels
awaiting-reply Awaiting reply fix-available A fix to the issue is available in a new version question Further information is requested

Comments

@hbarsaiyan
Copy link
Contributor

hbarsaiyan commented Nov 29, 2020

The SHA512 checksum of the AppImages releases are different from that mentioned in latest-linux.yml. For eg. in 1.6.4:

in latest-linux.yml:
sha512: 2bdeFR5gm96WlMlg97n/QPFoHTOLV12GlIeApvR6WlgYO1UG6eDCKzlZRoLTn+obQNlp3746Mu3hFJKwbJa/yw==

$ sha512sum YouTube-Music-1.6.4.AppImage
d9b75e151e609bde9694c960f7b9ff40f1681d338b575d86948780a6f47a5a58183b5506e9e0c22b39594682d39fea1b40d969dfbe3a32ede11492b06c96bfcb  YouTube-Music-1.6.4.AppImage
@hbarsaiyan
Copy link
Contributor Author

Or do these SHA512 hashes refer to something else?

@th-ch
Copy link
Owner

th-ch commented Nov 29, 2020

Hey @hbarsaiyan, thanks for submitting the issue! The release/update process comes from electron-builder - you can verify checksums in different ways:

$ sha512sum YouTube-Music-1.6.4.AppImage | cut -f1 -d\  | xxd -r -p | base64 -w 0
2bdeFR5gm96WlMlg97n/QPFoHTOLV12GlIeApvR6WlgYO1UG6eDCKzlZRoLTn+obQNlp3746Mu3hFJKwbJa/yw==
const path = require('path');
const fs = require('fs');
const crypto = require('crypto');

const YOUR_FILE_PATH = 'YouTube-Music-1.6.4.AppImage';

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.read());
        resolve(hash.read());
      })
      .pipe(
        hash,
        {
          end: false,
        }
      );
  });
}

const installerPath = path.resolve(
  __dirname,
  YOUR_FILE_PATH
);

hashFile(installerPath);
$ node hash.js
2bdeFR5gm96WlMlg97n/QPFoHTOLV12GlIeApvR6WlgYO1UG6eDCKzlZRoLTn+obQNlp3746Mu3hFJKwbJa/yw==

Does it answer your question?

@th-ch th-ch added awaiting-reply Awaiting reply fix-available A fix to the issue is available in a new version question Further information is requested labels Nov 29, 2020
@hbarsaiyan
Copy link
Contributor Author

@th-ch thanks for the detailed explanation. I didn't about Base64 hash encoding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-reply Awaiting reply fix-available A fix to the issue is available in a new version question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants