From 812ce057a2bc1cf16e43030e3331ca37bdef2c94 Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Sat, 22 May 2021 14:54:49 +0800 Subject: [PATCH] rename w1dev to comet --- README.md | 44 -------------------------------------------- index.js | 4 ++-- 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 855630d..a8b4385 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,6 @@ - 基于 secp256k1 等曲线算法的签名、交易的加解密 - 其他辅助算法工具 -- [tic.crypto](#ticcrypto) - - [硬件环境](#硬件环境) - - [软件环境](#软件环境) - - [安装指南](#安装指南) - - [用法](#用法) - - [编程接口规范](#编程接口规范) - ## 硬件环境 - 机型:Mac 或 PC 机 @@ -45,41 +38,4 @@ let kp=ticCrypto.secword2keypair(sw) // 把密语转换成公私钥 let address=ticCrypto.secword2address(sw) // 把密语转换成地址 ``` -## 编程接口规范 - -| 函数名 | 参数 | 备注 | -| ------------------------------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------- | ------ | ----------------------------------------------------- | --- | ---- | ------ | ---------------------------- | ------ | ------ | ------------------ | -| hash | (data, option={hasher:'sha256', salt, input:'utf8', output:'hex'}) | 哈希算法。给 input(=utf8 | latin1 | ascii)格式的输入 data 加 salt 后,根据 hasher(=sha256 | md5 | sha1 | sha512 | ripemd160),输出 output(=hex | latin1 | base64 | buf)格式的哈希值。 | -| isHashable | (data) | | -| isHash | | | -| encrypt | (data, pwd, option={ cipher:'aes-256-cfb', input:'utf8', output:'hex' }) | | -| decrypt | (data, pwd, option={ cipher:'aes-256-cfb', input:'hex', output:'utf8' }) | | -| sign | (data, seckey, option) | | -| isSignature | | | -| verify | (data, signature, pubkey, option) | | -| pass2keypair | | | -| secword2keypair | | 密语到公私钥 { pubkey, seckey } | -| seckey2pubkey | | | -| secword2account | | 密语到账户 { address, pubkey, seckey } | -| secword2address | | 密语到地址 address | -| isSecword | | | -| isSeckey | | | -| isPubkey | | | -| isAddress | | | -| pubkey2address | | | -| secword2seed | | | -| randomSecword | (lang) | lang=[ 'CHINESE', 'ENGLISH', 'FRENCH', 'ITALIAN', 'JAPANESE', 'SPANISH' ] | -| randomSeckey | | | -| randomKeypair | | | -| randomString | | | -| randomNumber | | | -| randomUuid: { [Function: v4] v1 | | | -| getMerkleRoot | | | -| distanceSig | | | -| compareSig | | | -| sortSigList | | | -| getString2Sign | | | -| rsaSign | | | -| rsaVerify | | | - --- diff --git a/index.js b/index.js index e71281f..fe7e3e4 100644 --- a/index.js +++ b/index.js @@ -193,7 +193,7 @@ class TICrypto { if (typeof data !== 'string' && !(data instanceof Buffer) && !(data instanceof DataView)) data = JSON.stringify(data) let ciphertext = encryptor.update(data, inputEncoding, outputEncoding) ciphertext += encryptor.final(outputEncoding) // 但是 Buffer + Buffer 还是会变成string - return { iv: iv.toString('hex'), ciphertext } + return { iv: iv.toString('hex'), ciphertext } // 有 iv,显然每次结果不一样 } } else if (keytype === 'seckey') { // 尚未走通,不能使用 ticCrypto 生成的 Elliptic curve 椭圆曲线算法公私钥,只能用 crypto.generateKeypairs() 生成的 rsa 公私钥 @@ -687,7 +687,7 @@ class TICrypto { case 'moon': prefix = 'b4' break // Base58: 0x7f=127,0x80=128 => t, Base64: t=0x2d=0b00101101 => 0b101101xx = 0xB4~B7 - case 'w1dev': + case 'comet': prefix = '74' break // Base58: 0x90 => d, Base 64: d=0x1d=0b00011101 => 0b 011101xx = 0x74~77 default: