package octez-libs
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=aa2f5bc99cc4ca2217c52a1af2a2cdfd3b383208cb859ca2e79ca0903396ca1d
sha512=d68bb3eb615e3dcccc845fddfc9901c95b3c6dc8e105e39522ce97637b1308a7fa7aa1d271351d5933febd7476b2819e1694f31198f1f0919681f1f9cc97cb3a
doc/octez-libs.crypto/Tezos_crypto/Crypto_box/index.html
Module Tezos_crypto.Crypto_boxSource
Tezos - X25519/XSalsa20-Poly1305 cryptography
generate_nonces ~incoming ~sent_msg ~recv_msg generates two nonces by hashing (Blake2B) the arguments. The nonces should be used to initialize the encryption on the communication channels. Because an attacker cannot control both messages, it cannot determine the nonces that will be used to encrypt the messages. The sent message should contains a random nonce, and we should never send the exact same message twice.
Size of the message authentication tag.
Generates both a secret key and its corresponding public key, along with a hash of the public key.
precompute pk sk computes a channel key from the sender's sk and the recipient's pk.
fast_box k nonce msg authenticates and encrypts msg and returns both the message authentication tag and the ciphertext. For this reason, the returned buffer will be tagbytes longer than msg.
fast_box_open k nonce cmsg attempts to verify and decrypt cmsg and if successful returns the plaintext. As above, the returned buffer will be tagbytes shorter than cmsg.
fast_box_noalloc k nonce tag buf authenticates and encrypts in-place the contents of buf using k and nonce and writes the message authentication tag in tag.
fast_box_open_noalloc k nonce tag buf attempts to verify and decrypt the contents of buf in-place using k, nonce, and tag and returns true if successful.
check_proof_of_work pk pow target returns true if pow is proof of work following target for the public key pk.
val generate_proof_of_work :
?yield_every:int ->
?max:int ->
public_key ->
pow_target ->
nonce Lwt.tgenerate_proof_of_work pk pow_target generates a proof of work for the public key pk following the pow_target.
The parameter yield_every (defaults to 500) inserts a cooperation point (Lwt.pause ()) every so many attempts. This allows other promises to make progress towards resolution. It also allows Unix signals to be processed so that, say, Ctrl+C can be effective.
The parameter max (not set by default) sets a maximum number of attempts to be made before giving up. When max number of attempts have been made and no pow has been found, the exception Not_found is raised.
neuterize sk generates the corresponding public key of sk
equal a b tests keys for equality