12345678910111213141516171819202122232425 |
- import { sm4 } from 'sm-crypto'
- const default_hexKey = '86C63180C2806ED1F47B859DE501215B'
- /*
- * text 待加密文本
- */
- export function encrypt(text) {
- const encrypt = sm4.encrypt(text, default_hexKey,{ mode: 'ecb', padding: 'pkcs#7' })
- return encrypt
- }
- /*
- * text 待解密密文
- */
- export function decrypt(text) {
- const decrypt = sm4.decrypt(text, default_hexKey,{ mode: 'ecb', padding: 'pkcs#7' })
- return decrypt
- }
- export default {
- encrypt,
- decrypt
- }
|