赞
踩
1.下载
npm install sm-crypto
2.sm2.js
import {sm2} from 'sm-crypto';
const publicKey = '找后端要';
const privateKey = '找后端要';
export const setPassword = (password)=>{
return sm2.doEncrypt(password,publicKey,1);
};
export const getPassword = (password)=>{
return sm2.doDecrypt(password.slice(2),privateKey,1);
};
加密调用setPassword, 解密用getPassword
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。