1.0.8 • Published 5 years ago
hita-tool v1.0.8
hita-tool
1.crypt
生成公私钥及其加解密
   const { crypt } = require('hita-tool')
   const { publicKey, privateKey } = crypt.generator() //生成公私钥
   const res = crypt.encrypt(text, publicKey)   // 公钥加密
   const res = crypt.decrypt(encryptedData, privateKey)   // 私钥解密
   const res = crypt.sEncrypt(text, publicKey)   // 私钥加密
   const res = crypt.pDecrypt(text, publicKey)   // 公钥解密2.uuid
生成唯一的appId
const { uuid } = require('hita-tool')
let id = uuid.getAppId()  //生成id2.objFun
对象的特殊方法
1 对象参数按照key升序排序,并转换为&拼接的字符串,用法:
const { objFun } = require('hita-tool')
let obj = {
   b: "1",
   a: "2",
   c: "3"
}
let sortStr = objFun.ksortAndToString(obj)2 将&拼接的字符串转换为对象,用法:
const { objFun } = require('hita-tool')
let obj = objFun.parseUrlObj(string)