perf:增加base64Key

This commit is contained in:
yz
2023-03-16 21:36:08 +08:00
parent 50aaf2957e
commit 4a60f7256b
2 changed files with 98 additions and 91 deletions

View File

@@ -1,12 +1,11 @@
const base64js = require("base64-js");
const keyBase64 = "WmdUzPJXbngVNiaSsQrihg==";
const SM4 = require("./SM4");
class Crypto {
constructor() {
this.sm4 = new SM4({
keyBuffer: base64js.toByteArray(keyBase64),
keyBuffer: base64js.toByteArray(window.httpConfig.base64Key),
mode: "ecb",
cipherType: 'base64'
})
@@ -31,4 +30,4 @@ class Crypto {
}
}
module.exports = new Crypto();
module.exports = new Crypto();