https://github.com/gavinning/node-crypto
加密
https://github.com/gavinning/node-crypto
Last synced: over 1 year ago
JSON representation
加密
- Host: GitHub
- URL: https://github.com/gavinning/node-crypto
- Owner: gavinning
- Created: 2016-08-16T07:46:02.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-08-16T07:46:30.000Z (almost 10 years ago)
- Last Synced: 2025-03-02T22:45:43.611Z (over 1 year ago)
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
Crypto
---
以``nodejs``官方``crypto``加密模块为核心
### Install
```sh
npm i node-crypto --save
```
### Usage
```js
var Crypto = require('node-crypto')
var cp = new Crypto('you secret code')
var base64 = cp.base('123456')
console.log(base64)
// =>
// 2VyW6u0OSBYr5VIYRhJ5FXLOtec=
var hex = cp.hex('123456')
console.log(hex)
// =>
// d95c96eaed0e48162be552184612791572ceb5e7
console.log( cp.baseToHex('2VyW6u0OSBYr5VIYRhJ5FXLOtec=') )
// =>
// d95c96eaed0e48162be552184612791572ceb5e7
console.log( cp.hexToBase('d95c96eaed0e48162be552184612791572ceb5e7') )
// =>
// 2VyW6u0OSBYr5VIYRhJ5FXLOtec=
```