2016-11-03 22:15:31 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2017-11-14 03:36:14 +04:00
|
|
|
(* Copyright (c) 2014 - 2017. *)
|
2016-11-03 22:15:31 +04:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
|
|
|
(** Tezos - X25519/XSalsa20-Poly1305 cryptography *)
|
|
|
|
|
|
|
|
type nonce
|
|
|
|
|
|
|
|
val random_nonce : unit -> nonce
|
|
|
|
val increment_nonce : ?step:int -> nonce -> nonce
|
2016-11-16 04:19:13 +04:00
|
|
|
val nonce_encoding : nonce Data_encoding.t
|
|
|
|
|
2016-11-18 00:02:32 +04:00
|
|
|
type target
|
2016-11-19 02:07:27 +04:00
|
|
|
val default_target : target
|
2017-01-23 14:09:51 +04:00
|
|
|
val make_target : float -> target
|
2016-11-18 00:02:32 +04:00
|
|
|
|
2016-11-16 04:19:13 +04:00
|
|
|
type secret_key
|
|
|
|
type public_key
|
2017-11-27 09:13:12 +04:00
|
|
|
module Public_key_hash : S.INTERNAL_HASH
|
2017-01-14 16:13:49 +04:00
|
|
|
type channel_key
|
2016-11-16 04:19:13 +04:00
|
|
|
|
|
|
|
val public_key_encoding : public_key Data_encoding.t
|
|
|
|
val secret_key_encoding : secret_key Data_encoding.t
|
|
|
|
|
2017-01-14 16:13:49 +04:00
|
|
|
val hash : public_key -> Public_key_hash.t
|
|
|
|
val random_keypair : unit -> secret_key * public_key * Public_key_hash.t
|
2016-11-16 04:19:13 +04:00
|
|
|
|
2016-11-03 22:15:31 +04:00
|
|
|
val box : secret_key -> public_key -> MBytes.t -> nonce -> MBytes.t
|
2016-11-08 02:38:02 +04:00
|
|
|
val box_open : secret_key -> public_key -> MBytes.t -> nonce -> MBytes.t option
|
2016-11-16 04:19:13 +04:00
|
|
|
|
2017-01-14 16:13:49 +04:00
|
|
|
val precompute : secret_key -> public_key -> channel_key
|
|
|
|
val fast_box : channel_key -> MBytes.t -> nonce -> MBytes.t
|
|
|
|
val fast_box_open : channel_key -> MBytes.t -> nonce -> MBytes.t option
|
|
|
|
|
2016-11-18 00:02:32 +04:00
|
|
|
val check_proof_of_work : public_key -> nonce -> target -> bool
|
2017-01-23 14:09:48 +04:00
|
|
|
val generate_proof_of_work : ?max:int -> public_key -> target -> nonce
|
2017-01-14 16:13:49 +04:00
|
|
|
|