JSPM

node-crypto

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 21
  • Score
    100M100P100Q71203F
  • License MIT

crypto, 加密

Package Exports

  • node-crypto

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-crypto) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Crypto

nodejs官方crypto加密模块为核心

Install

npm i node-crypto --save

Usage

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=