-
-
Save zhangyoufu/93066c33f317e10b405fdc7aed20d07f to your computer and use it in GitHub Desktop.
Generator/Apnonce generation script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* genap | |
* 1Conan | |
*/ | |
const crypto = require('crypto'); | |
const reverse = require('buffer-reverse'); | |
const hash = crypto.createHash('sha1'); | |
//Data | |
const random = crypto.randomBytes(8); | |
//const random = Buffer.from('e6f69faea9e7bf21', 'hex'); //Should give 516f88661d86335bf084ec9c0617333fbe67659c in apnonce for lower devices | |
let reversed = reverse(random); | |
const apnonce = crypto.createHash('sha1').update(reversed).digest('hex'); | |
const apnonce7 = crypto.createHash('sha384').update(reversed).digest('hex'); | |
console.log('generator:', '0x' + random.toString('hex')); | |
console.log('To be hashed:', '0x' + reversed.toString('hex')); | |
console.log('apnonce: ', apnonce); | |
console.log('apnonce (iPhone7):', apnonce7); |
Author
zhangyoufu
commented
Feb 27, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment