Merge pull request '优化 QMCCache 解密过程' (#6) from jixunmoe/um-web:refactor/optimise-qm-cache-decode into master
Reviewed-on: https://git.unlock-music.dev/um/web/pulls/6remotes/origin/HEAD
commit
2872ceb3bb
@ -0,0 +1,20 @@
|
|||||||
|
import { DecryptBuffer as DecryptQmcCacheBuffer } from '../qmccache';
|
||||||
|
import fs from 'fs';
|
||||||
|
|
||||||
|
const expectedBuffer = fs.readFileSync(__dirname + '/fixture/qmc_cache_expected.bin');
|
||||||
|
|
||||||
|
const createInputBuffer = () => {
|
||||||
|
const buffer = Buffer.alloc(256);
|
||||||
|
for (let i = buffer.byteLength; i >= 0; i--) {
|
||||||
|
buffer[i] = i;
|
||||||
|
}
|
||||||
|
return buffer;
|
||||||
|
};
|
||||||
|
|
||||||
|
describe('decrypt/qmccache', () => {
|
||||||
|
it('should decrypt specified buffer correctly', () => {
|
||||||
|
const input = createInputBuffer();
|
||||||
|
DecryptQmcCacheBuffer(input);
|
||||||
|
expect(input).toEqual(expectedBuffer);
|
||||||
|
});
|
||||||
|
});
|
Binary file not shown.
Loading…
Reference in New Issue