1.0.7 • Published 10 months ago

@xushuyi/crypt v1.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

crypt

私有加解密模块,定制模块。

配置

开发环境下

  • AES 加密模式 CBC
  • 填充模式 zeropadding
  • 密钥key 1234567890123456
  • 偏移量iv 1234567890abcdef
  • 输出hex

生产环境下

  • AES 加密模式 CBC
  • 填充模式 pkcs5padding
  • 密钥key 从配置文件中读取
  • 偏移量iv 从配置文件中读取
  • 需要mac address被授权
  • 输出hex

示例

const plainText = "欢迎使用crypt加解密模块。";

console.log('当前加密环境:', crypt.env());
const cipherText = crypt.zmencrypt(plainText);
const cipherPhone = crypt.zmencrypt('13800138000');
console.log('cipherPhone=', cipherPhone);

输出结果: 30bd4f3848b25fae0218a6dcb6ca4a7c

插件提供的方法

  • env 插件的环境变量, 非process.env.NODE_ENV变量
  • md5 MD5方法
  • macaddress 获取服务器mac地址
  • indocker 判断是否在docker环境中
  • zmencrypt 加密方法 aes/cbc/zeropadding/128bit/hex
  • zmdecrypt 解密方法 aes/cbc/zeropadding/128bit/hex
  • starzmdecrypt 解密方法 手机号码星号输出
  • encrypt 加密方法 aes/cbc/pkcs5padding/128bit/hex
  • decrypt 解密方法 aes/cbc/pkcs5padding/128bit/hex
  • stardecrypt 解密方法 手机号码星号输出
1.0.7

10 months ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago