rename all libs from xxx.yyy to xxx-yyy
This commit is contained in:
16
README.md
16
README.md
@@ -1,4 +1,4 @@
|
||||
# tic.crypto
|
||||
# tic-crypto
|
||||
|
||||
时光链区块链密码学算法工具库:为区块链相关应用开发提供一套底层的基础算法工具库,用来处理哈希、加解密、签名、助记词、等等。
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
在前后端软件的 package.json 的依赖清单中引入本库:
|
||||
|
||||
```
|
||||
npm install git+https://git.faronear.org/npm/tic.crypto#RELEASE_OR_BRANCH --save
|
||||
npm install git+https://git.faronear.org/npm/tic-crypto#RELEASE_OR_BRANCH --save
|
||||
```
|
||||
|
||||
## 用法
|
||||
@@ -32,10 +32,10 @@ npm install git+https://git.faronear.org/npm/tic.crypto#RELEASE_OR_BRANCH --save
|
||||
基本用法示例:
|
||||
|
||||
```
|
||||
let ticCrypto=require('tic.crypto') // 引用
|
||||
let sw=ticCrypto.randomSecword() // 生成一个随机的助记词(即密语)。或者使用现成的密语。
|
||||
let kp=ticCrypto.secword2keypair(sw) // 把密语转换成公私钥
|
||||
let address=ticCrypto.secword2address(sw) // 把密语转换成地址
|
||||
let ticrypto=require('tic-crypto') // 引用
|
||||
let sw=ticrypto.randomSecword() // 生成一个随机的助记词(即密语)。或者使用现成的密语。
|
||||
let kp=ticrypto.secword2keypair(sw) // 把密语转换成公私钥
|
||||
let address=ticrypto.secword2address(sw) // 把密语转换成地址
|
||||
```
|
||||
|
||||
## 其他
|
||||
@@ -91,9 +91,9 @@ crypto.publicEncrypt(kp.publicKey, Buffer.from('sdafasfdsaf'))
|
||||
|
||||
返回 Buffer。每次结果不一样
|
||||
|
||||
似乎 crypto 一定要 rsa 公私钥才可以用加解密,ticCrypto.randomKeypair() 生成的 ecc 公私钥不行。
|
||||
似乎 crypto 一定要 rsa 公私钥才可以用加解密,ticrypto.randomKeypair() 生成的 ecc 公私钥不行。
|
||||
|
||||
而 eccrypto 和 eccrypto-js 可以用。eccrypto.generateKeyPair() 生成的和 ticCrypto.randomKeypair() 一样
|
||||
而 eccrypto 和 eccrypto-js 可以用。eccrypto.generateKeyPair() 生成的和 ticrypto.randomKeypair() 一样
|
||||
|
||||
eccrypto 在 windows 上的安装有麻烦,一来需要手工安装 OpenSSL 到 c:\openssl-win64\,二来 openssl 1.1.0 起把 libeay32.lib 改名为 libcrypto.dll,而 eccrypto 需要 c:\openssl-win64\lib\libeay32.lib,会报错
|
||||
|
||||
|
||||
Reference in New Issue
Block a user