package octez-protocol-017-PtNairob-libs

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

This module is a more generic version of Bytes, where each scalar stores an nb_bits-bit number.

Parameters

module N : sig ... end

Signature

type 'a input = 'a Input.t

Input for a Plompiler program.

type scalar = scalar

Element of the native scalar field.

type 'a repr = 'a repr

Representation of values.

type 'a t = 'a t

Plompiler program.

type tl = scalar list

Representation of elements.

val input_bytes : le:bool -> bytes -> tl input

input_bytes ~le b returns the representation of b that Plompiler expects as input. le can be used to set the endianness.

val constant : le:bool -> bytes -> tl repr t

constant ~le b returns the constant b as a Plompiler value. le can be used to set the endianness.

val of_scalar : total_nb_bits:int -> scalar repr -> tl repr t

of_scalar ~total_nb_bits b converts the scalar b of size total_nb_bits in bits into the tl representation.

val to_scalar : tl repr -> scalar repr t

to_scalar b return the scalar representing the value b.

val of_bool_list : bool list repr -> tl repr t

of_bool_list b converts the list of bits in little-endian order into the tl representation.

val to_bool_list : tl repr -> bool list repr t

to_bool_list b returns the list of bits in little-endian order, representing the value b.

val xor : tl repr -> tl repr -> tl repr t

xor a b returns the exclusive disjunction of a and b.

val band : tl repr -> tl repr -> tl repr t

band a b returns the conjunction of a and b.

val not : tl repr -> tl repr t

not b returns the negation of b.

val rotate_right : tl repr -> int -> tl repr t

rotate_right b n shifts the bits right by n positions, so that each bit is less significant. The least significant bit becomes the most significant i.e. it is "rotated". rotate_right bs (length bl) = bl

val shift_right : tl repr -> int -> tl repr t

shift_right b n shifts all bits right by n positions, so that each bit is less significant. The least signigicant bit is lost and the most significant bit is set to zero. More precisely, if we interpret the b as an integer, shift_right b n = b / 2^n

OCaml

Innovation. Community. Security.