修正SM4解密时产生错误结果的bug

This commit is contained in:
539943419 committed 2024-07-19 19:59:16 +08:00
1 parent f0e4a777d9
commit b29add4ae5
5 files changed
+139 -107

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
import sha256 from 'crypto-js/sha256.js';
import Database from "better-sqlite3";
const dbPath = "./miaoShare.db";
const db = new Database(dbPath, { verbose: null });
const stmt_insertId2FileName = db.prepare(`INSERT INTO USERS (user_id, password_hash, user_group, uploadFilesSizeCount) VALUES (?, ?, ?, 0)`);
let userList = [
['539943419','zjh030628','admin'],
// ['guest','guest','guest']
].map(a=>{a[1]=sha256(a[0]+sha256(a[1]).toString()).toString();return a})
for(let i of userList){
stmt_insertId2FileName.run(...i)
}