Created
May 6, 2015 07:45
-
-
Save McSimp/09b29ad1e51502a6b6d0 to your computer and use it in GitHub Desktop.
Adventure Capitalist Decoding
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
var lzf = require('lzf'); | |
var crypto = require('crypto'); | |
function DecodeSaveData(data) { | |
// Format is: .<Base64 encoded LZF compressed data>|<MD5 hash of data> | |
if (data.indexOf('.') !== 0) { | |
throw Error('Invalid save data'); | |
} | |
var splitStr = data.substr(1).split('|'); | |
if (splitStr.length != 2) { | |
throw Error('Invalid save data'); | |
} | |
var b64Data = splitStr[0]; | |
var refHash = splitStr[1]; | |
var compressedData = new Buffer(b64Data, 'base64'); | |
var decompressedData = lzf.decompress(compressedData).toString('utf8'); | |
var computedHash = crypto | |
.createHash('md5') | |
.update(decompressedData + 'makeripples') | |
.digest('hex'); | |
if (computedHash != refHash) { | |
throw Error('Invalid hash'); | |
} | |
return JSON.parse(decompressedData); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
makeripples
seems to be the wrong salt for the current adcap version (1.1.1.1202-45e2c59 on Steam).Any idea where to find a working one?