mirror of
https://github.com/xhacker-zzz/QmcWasm.git
synced 2024-12-05 00:42:17 +00:00
Compare commits
6 Commits
8373c96f38
...
15144510d4
Author | SHA1 | Date | |
---|---|---|---|
15144510d4 | |||
8a876af839 | |||
976b70943a | |||
8875fbdfc7 | |||
333d0ac868 | |||
c7eeeeb57a |
10
.gitignore
vendored
10
.gitignore
vendored
@ -360,4 +360,12 @@ MigrationBackup/
|
|||||||
.ionide/
|
.ionide/
|
||||||
|
|
||||||
# Fody - auto-generated XML schema
|
# Fody - auto-generated XML schema
|
||||||
FodyWeavers.xsd
|
FodyWeavers.xsd
|
||||||
|
|
||||||
|
# content from build
|
||||||
|
npm/LICENSE.txt
|
||||||
|
npm/QmcWasm.wasm
|
||||||
|
npm/QmcLegacy.js
|
||||||
|
npm/QmcWasm.js
|
||||||
|
npm/QmcWasmBundle.js
|
||||||
|
build/
|
@ -26,6 +26,8 @@ const decrypted= (await DecryptQmcWasm(cipherText, extension)).data;
|
|||||||
|
|
||||||
### 自行构建
|
### 自行构建
|
||||||
|
|
||||||
|
#### 依赖
|
||||||
|
要自行构建此项目,请确保已经安装[Git]与[CMake]且其路径已经添加到 `PATH`
|
||||||
#### Linux
|
#### Linux
|
||||||
在此项目根目录中执行 `./build-wasm` 即可构建。构建结果将位于此项目根目录的npm子目录中。
|
在此项目根目录中执行 `./build-wasm` 即可构建。构建结果将位于此项目根目录的npm子目录中。
|
||||||
#### Windows
|
#### Windows
|
||||||
@ -38,3 +40,5 @@ const decrypted= (await DecryptQmcWasm(cipherText, extension)).data;
|
|||||||
[授权协议]: https://github.com/nullptr-0/QmcWasm/blob/master/LICENSE.txt
|
[授权协议]: https://github.com/nullptr-0/QmcWasm/blob/master/LICENSE.txt
|
||||||
[qmc_wasm.ts]: https://github.com/nullptr-0/QmcWasm/blob/master/qmc_wasm.ts
|
[qmc_wasm.ts]: https://github.com/nullptr-0/QmcWasm/blob/master/qmc_wasm.ts
|
||||||
[GitHub Actions]: https://github.com/nullptr-0/QmcWasm/actions
|
[GitHub Actions]: https://github.com/nullptr-0/QmcWasm/actions
|
||||||
|
[Git]: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
|
||||||
|
[CMake]: https://cmake.org/download/
|
||||||
|
@ -11,6 +11,18 @@ if not exist build\emsdk (
|
|||||||
git clone https://github.com/emscripten-core/emsdk.git build\emsdk
|
git clone https://github.com/emscripten-core/emsdk.git build\emsdk
|
||||||
)
|
)
|
||||||
|
|
||||||
|
rem Check for Ninja binary
|
||||||
|
pushd build\wasm
|
||||||
|
if not exist "ninja.exe" (
|
||||||
|
rem Install Ninja
|
||||||
|
curl -L https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip -o ninja.zip
|
||||||
|
tar -xzvf ninja.zip
|
||||||
|
del ninja.zip
|
||||||
|
)
|
||||||
|
rem must setup PATH for ninja first to avoid conflict with emsdk_env.bat
|
||||||
|
set PATH="%PATH%;%cd%"
|
||||||
|
popd
|
||||||
|
|
||||||
pushd build\emsdk
|
pushd build\emsdk
|
||||||
rem git pull
|
rem git pull
|
||||||
call emsdk.bat install 3.0.0
|
call emsdk.bat install 3.0.0
|
||||||
@ -21,13 +33,6 @@ popd
|
|||||||
pushd build\wasm
|
pushd build\wasm
|
||||||
|
|
||||||
call emcmake cmake -DCMAKE_BUILD_TYPE=%BUILD_TYPE% ..\..
|
call emcmake cmake -DCMAKE_BUILD_TYPE=%BUILD_TYPE% ..\..
|
||||||
rem Check if Ninja binary exists
|
|
||||||
if not exist "ninja.exe" (
|
|
||||||
rem Install Ninja
|
|
||||||
curl -L https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip -o ninja.zip
|
|
||||||
unzip ninja.zip
|
|
||||||
del ninja.zip
|
|
||||||
)
|
|
||||||
ninja.exe -f build.ninja -j 3
|
ninja.exe -f build.ninja -j 3
|
||||||
|
|
||||||
set "TARGET_FILES=QmcLegacy.js QmcWasm.js QmcWasm.wasm QmcWasmBundle.js %CURR_DIR%\LICENSE.txt"
|
set "TARGET_FILES=QmcLegacy.js QmcWasm.js QmcWasm.wasm QmcWasmBundle.js %CURR_DIR%\LICENSE.txt"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/xhacker-zzz/QmcWasm.git"
|
"url": "git+https://github.com/nullptr-0/QmcWasm.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"unlock-music",
|
"unlock-music",
|
||||||
@ -18,7 +18,7 @@
|
|||||||
"author": "xhacker-zzz",
|
"author": "xhacker-zzz",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/xhacker-zzz/QmcWasm/issues"
|
"url": "https://github.com/nullptr-0/QmcWasm/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/xhacker-zzz/QmcWasm#readme"
|
"homepage": "https://github.com/nullptr-0/QmcWasm#readme"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include"TencentTea.hpp"
|
#include "TencentTea.hpp"
|
||||||
#include "base64.hpp"
|
#include "base64.hpp"
|
||||||
|
|
||||||
void simpleMakeKey(uint8_t salt, int length, std::vector<uint8_t> &key_buf) {
|
void simpleMakeKey(uint8_t salt, int length, std::vector<uint8_t> &key_buf) {
|
||||||
|
@ -2,7 +2,7 @@ import { QmcCrypto } from '@xhacker/qmcwasm/QmcWasmBundle';
|
|||||||
import QmcCryptoModule from '@xhacker/qmcwasm/QmcWasmBundle';
|
import QmcCryptoModule from '@xhacker/qmcwasm/QmcWasmBundle';
|
||||||
import { MergeUint8Array } from '@/utils/MergeUint8Array';
|
import { MergeUint8Array } from '@/utils/MergeUint8Array';
|
||||||
|
|
||||||
// 每次处理 2M 的数据
|
// 每次可以处理 2M 的数据
|
||||||
const DECRYPTION_BUF_SIZE = 2 *1024 * 1024;
|
const DECRYPTION_BUF_SIZE = 2 *1024 * 1024;
|
||||||
|
|
||||||
export interface QMCDecryptionResult {
|
export interface QMCDecryptionResult {
|
||||||
@ -38,11 +38,12 @@ export async function DecryptQmcWasm(qmcBlob: ArrayBuffer, ext: string): Promise
|
|||||||
// 申请内存块,并文件末端数据到 WASM 的内存堆
|
// 申请内存块,并文件末端数据到 WASM 的内存堆
|
||||||
const qmcBuf = new Uint8Array(qmcBlob);
|
const qmcBuf = new Uint8Array(qmcBlob);
|
||||||
const pQmcBuf = QmcCryptoObj._malloc(DECRYPTION_BUF_SIZE);
|
const pQmcBuf = QmcCryptoObj._malloc(DECRYPTION_BUF_SIZE);
|
||||||
QmcCryptoObj.writeArrayToMemory(qmcBuf.slice(-DECRYPTION_BUF_SIZE), pQmcBuf);
|
const preDecDataSize = Math.min(DECRYPTION_BUF_SIZE, qmcBlob.byteLength); // 初始化缓冲区大小
|
||||||
|
QmcCryptoObj.writeArrayToMemory(qmcBuf.slice(-preDecDataSize), pQmcBuf);
|
||||||
|
|
||||||
// 进行解密初始化
|
// 进行解密初始化
|
||||||
ext = '.' + ext;
|
ext = '.' + ext;
|
||||||
const tailSize = QmcCryptoObj.preDec(pQmcBuf, DECRYPTION_BUF_SIZE, ext);
|
const tailSize = QmcCryptoObj.preDec(pQmcBuf, preDecDataSize, ext);
|
||||||
if (tailSize == -1) {
|
if (tailSize == -1) {
|
||||||
result.error = QmcCryptoObj.getErr();
|
result.error = QmcCryptoObj.getErr();
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user