i search how to get the id of a file, i can get the key with
var node_crypto = require('crypto');
function d64(s) {
s += '=='.substr((2-s.length*3)&3)
s = s.replace(/-/g,'+').replace(/_/g,'/').replace(/,/g,'')
return new Buffer(s, 'base64')
}
function from256to128(s) {
var o = new Buffer(16)
for (var i = 0; i < 16; i++) {
o[i] = s[i] ^ s[i + 16]
}
return o
}
var file = {"h":"zR8niALR","p":"GJclVaKI","u":"65fYYu5ZLBU","t":0,"a":"p91p4G1aF4DSOUajkxGgTuJDBnGqXIa4XBNSkJu1zwkWjhS8iCZmdoCRWDX3ebmBDemU_VFYvoAGTq8mb6LtuQ","k":"GJclVaKI:vhe23fV90E6We7hrSzoXtZYafjBwjqYSQcAZOlrQGLo","s":2529042,"ts":1395678307};
var k0 = d64("AOUU-DEgRdg4Khd4zM7ndA"); // original folder key
var iv = Buffer(16);
iv.fill(0);
var k = d64(file.k.split(':')[1]);
var u = d64(file.h); // seems to be the id, i have yAlxkCRS when i do right click -> get link on this file in my account
var aes = nodecrypto.createDecipheriv('aes-128-ecb', k0, Buffer(0));
aes.setAutoPadding(false);
var kfdec = aes.update(k).toString('base64').replace(/+/g,'-').replace(/\//g,'').replace(/=/g,'');
var k2dec = from256to128(aes.update(k));
//print decoded key
console.log(kfdec)
// how to get the decoded u var ?
// goal is the get the same result than get link function in mega
hi
i search how to get the id of a file, i can get the key with
var node_crypto = require('crypto');
function d64(s) { s += '=='.substr((2-s.length*3)&3) s = s.replace(/-/g,'+').replace(/_/g,'/').replace(/,/g,'') return new Buffer(s, 'base64') }
function from256to128(s) { var o = new Buffer(16) for (var i = 0; i < 16; i++) { o[i] = s[i] ^ s[i + 16] } return o }
var file = {"h":"zR8niALR","p":"GJclVaKI","u":"65fYYu5ZLBU","t":0,"a":"p91p4G1aF4DSOUajkxGgTuJDBnGqXIa4XBNSkJu1zwkWjhS8iCZmdoCRWDX3ebmBDemU_VFYvoAGTq8mb6LtuQ","k":"GJclVaKI:vhe23fV90E6We7hrSzoXtZYafjBwjqYSQcAZOlrQGLo","s":2529042,"ts":1395678307};
var k0 = d64("AOUU-DEgRdg4Khd4zM7ndA"); // original folder key var iv = Buffer(16); iv.fill(0);
var k = d64(file.k.split(':')[1]); var u = d64(file.h); // seems to be the id, i have yAlxkCRS when i do right click -> get link on this file in my account var aes = nodecrypto.createDecipheriv('aes-128-ecb', k0, Buffer(0)); aes.setAutoPadding(false); var kfdec = aes.update(k).toString('base64').replace(/+/g,'-').replace(/\//g,'').replace(/=/g,''); var k2dec = from256to128(aes.update(k));
//print decoded key console.log(kfdec)
// how to get the decoded u var ? // goal is the get the same result than get link function in mega