package octez-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=dbc3b675aee59c2c574e5d0a771193a2ecfca31e7a5bc5aed66598080596ce1c
sha512=b97ed762b9d24744305c358af0d20f394376b64bfdd758dd4a81775326caf445caa57c4f6445da3dd6468ff492de18e4c14af6f374dfcbb7e4d64b7b720e5e2a
doc/octez-libs.crypto/Tezos_crypto/Base58/index.html
Module Tezos_crypto.Base58
Source
Prefixed Base58Check encodings
An extensible sum-type for decoded data: one case per known "prefix". See for instance Hash.Block_hash.Hash
or Environment.Ed25519.Public_key_hash
.
type 'a encoding = private {
prefix : string;
length : int;
encoded_prefix : string;
encoded_length : int;
to_raw : 'a -> string;
of_raw : string -> 'a option;
wrap : 'a -> data;
}
Abstract representation of registered encodings. The type parameter is the type of the encoded data, for instance Hash.Block_hash.t
.
val register_encoding :
prefix:string ->
length:int ->
to_raw:('a -> string) ->
of_raw:(string -> 'a option) ->
wrap:('a -> data) ->
'a encoding
Register a new encoding. The function might raise Invalid_arg
if the provided prefix
overlaps with a previously registered prefix. The to_raw
and of_raw
are the ad-hoc serialisation/deserialisation for the data. The wrap
should wrap the deserialised value into the extensible sum-type data
(see the generic function decode
).
Checks that an encoding has a certain prefix and length.
Encoder for a given kind of data.
Decoder for a given kind of data. It returns None
when the decoded data does not start with the expected prefix.
Generic decoder. It returns None
when the decoded data does not start with a registered prefix.
Completion of partial Base58Check value
Register a (global) resolver for a previously registered kind of data.
Try to complete a prefix of a Base58Check encoded data, by using the previously registered resolver associated to this kind of data. Note that a prefix of n
characters of a Base58-encoded value provides at least n/2
bytes of a prefix of the original value.
Low-level: distinct registering function for economic protocol
See src/environment/v1/base58.mli
for an inlined documentation.
Low-level Base58Check encodings
Base58Check-encoding/decoding functions (with error detections).
Base58-encoding/decoding functions (without error detections).