Last active
February 13, 2019 09:38
-
-
Save 1Conan/ac53cb8316b9d9b3523dfff326f9a4f9 to your computer and use it in GitHub Desktop.
Generator/Apnonce generation script
This file contains hidden or 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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment