1.0.0 • Published 3 years ago

encrytion v1.0.0

Weekly downloads
-
License
-
Repository
github
Last release
3 years ago

介绍

给文本进行加密和解密的工具

使用

在传统项目中使用

<script src="https://gitee.com/xlou/encrytion/raw/master/dist/encrytion.min.js"></script>
<!-- 建议下载下来使用 -->
<script>
  /* 引入了该 js 文件后,会在 window 上赋值 Encry 对象 */
  let text=Encry.encrypt("hello encrytion","666666")
</script>

在 Vue 、React 和 Angular 等项目中使用

安装

npm i encrytion -S

main.js / main.ts 中使用

import {Encry} from 'encrytion'

let text=Encry.encrypt("hello encrytion","666666")

API

encrypt:(input:string,password?:string)=>string加密字符串

let text=Encry.encrypt("hello encrytion","666666") // 密钥是 666666
console.log(text) // 'aYVsBYHSZGKbcnl0aG9u'

decrypt:(input:string,password?:string)=>string解密字符串

let text=Encry.decrypt('aYVsBYHSZGKbcnl0aG9u',"666666")
console.log(text) // 'hello encrytion'