完善使用worker进行加密解密相关代码

This commit is contained in:
539943419 committed 2024-07-19 17:24:08 +08:00
1 parent 3c2dc0f183
commit f0e4a777d9
6 files changed
+48 -26

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
import { sm4 } from 'sm-crypto'
self.onmessage = async function (event) {
const data = event.data.data
const key = event.data.key
const encryptData = sm4.encrypt(data, key, {
padding: 'pkcs#7',
output: 'array'
})
self.postMessage(new Uint8Array(encryptData))
}