@perfylee/crypto
v0.1.1
Published
encryption module used in project
Downloads
15
Readme
加解密工具
对常用加解密方法的二次封装,方便在项目中使用
安装
//npm
npm install @perfylee/crypto
//yarn
yarn add @perfylee/crypto
使用
MD5
MD5加密,返回结果小写
import {md5} from '@perfylee/crypto'
const encrypted = md5('input')
TripleDES
TripleDES加解密,密钥为长度24的字符串的base64编码,加密返回结果小写
import {tripleDES} from '@perfylee/crypto'
const encrypted = tripleDES.encrypt('input','密钥')
const decrypted = tripleDES.decrypt(encrypted,'密钥')
Base64
Base64编码和解码
import {base64} from '@perfylee/crypto'
const output = base64.parse('input')
const input = base64.stringify(output)