mono项目开发模板,内置cli管理构建
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
谢亚昕 96c19502bd feat: add crypto-wasm package for SM4 encryption/decryption, update dependencies, and enhance build scripts 23 hours ago
..
src feat: add crypto-wasm package for SM4 encryption/decryption, update dependencies, and enhance build scripts 23 hours ago
Cargo.lock feat: add crypto-wasm package for SM4 encryption/decryption, update dependencies, and enhance build scripts 23 hours ago
Cargo.toml feat: add crypto-wasm package for SM4 encryption/decryption, update dependencies, and enhance build scripts 23 hours ago
README.md feat: add crypto-wasm package for SM4 encryption/decryption, update dependencies, and enhance build scripts 23 hours ago
package.json feat: add crypto-wasm package for SM4 encryption/decryption, update dependencies, and enhance build scripts 23 hours ago
vitest.config.ts feat: add crypto-wasm package for SM4 encryption/decryption, update dependencies, and enhance build scripts 23 hours ago

README.md

crypto-wasm

JavaScript / TypeScript 调用

import { encrypt, decrypt } from '@dm/crypto-wasm';

function main() {
  const cipher = encrypt('hello world');
  const plain = decrypt(cipher);

  console.log(cipher); // Base64
  console.log(plain);  // hello world
}

main();

3) API

  • encrypt(data: string): string:返回 Base64 密文
  • decrypt(data: string): string:返回明文字符串