hypercore-crypto

WebJar for hypercore-crypto

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

hypercore-crypto
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

hypercore-crypto
WebJar for hypercore-crypto
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/mafintosh/hypercore-crypto

Скачать hypercore-crypto

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/hypercore-crypto/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>hypercore-crypto</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/hypercore-crypto/
implementation 'org.webjars.npm:hypercore-crypto:1.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/hypercore-crypto/
implementation ("org.webjars.npm:hypercore-crypto:1.0.0")
'org.webjars.npm:hypercore-crypto:jar:1.0.0'
<dependency org="org.webjars.npm" name="hypercore-crypto" rev="1.0.0">
  <artifact name="hypercore-crypto" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='hypercore-crypto', version='1.0.0')
)
libraryDependencies += "org.webjars.npm" % "hypercore-crypto" % "1.0.0"
[org.webjars.npm/hypercore-crypto "1.0.0"]

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
org.webjars.npm : buffer-alloc-unsafe jar [1.1.0,2)
org.webjars.npm : buffer-from jar [1.1.0,2)
org.webjars.npm : sodium-universal jar [2.0.0,3)
org.webjars.npm : uint64be jar [2.0.2,3)

Модули Проекта

Данный проект не имеет модулей.

hypercore-crypto

The crypto primitives used in hypercore, extracted into a separate module

npm install hypercore-crypto

Usage

const crypto = require('hypercore-crypto')

const keyPair = crypto.keyPair()
console.log(keyPair) // prints a ed25519 keypair

API

keyPair = crypto.keyPair()

Returns an ED25519 keypair that can used for tree signing.

signature = crypto.sign(message, secretKey)

Signs a message (buffer).

verified = crypto.verify(message, signature, publicKey)

Verifies a signature for a message.

hash = crypto.data(data)

Hashes a leaf node in a merkle tree.

hash = crypto.parent(left, right)

Hash a parent node in a merkle tree. left and right should look like this:

{
  index: treeIndex,
  hash: hashOfThisNode,
  size: byteSizeOfThisTree
}

hash = crypto.tree(peaks)

Hashes the merkle root of the tree. peaks should be an array of the peaks of the tree and should look like above.

dataToSign = crypto.signable(peaksOrHash, length)

Encodes a buffer to sign. length should be how many leaf nodes exist in the tree.

buffer = crypto.randomBytes(size)

Returns a buffer containing random bytes of size size.

hash = crypto.discoveryKey(publicKey)

Return a hash derived from a publicKey that can used for discovery without disclosing the public key.

License

MIT

Версии библиотеки

Версия
1.0.0