package binsec

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

Representation of binary streams

Types

type t

Constructors

val empty : t
val of_nibbles : string -> t

of_nibbles s converts a string s of hexadecimal characters.

@assumes each character is in the range 0-9a-f.

val of_bytes : string -> t

of_bytes s converts a byte stream s. Each character stands for its own byte.

val of_list : int list -> t

of_list l converts a list of integers.

@assumes: each integer n is in the range 0 <= n <= 255.

Operations

val append_int : int -> t -> t
val prepend_int : int -> t -> t
val append_int64 : int64 -> t -> t
val prepend_int64 : int64 -> t -> t
val append_char : char -> t -> t
val prepend_char : char -> t -> t
val rev : t -> t

Iterators

val iter : (int -> unit) -> t -> unit
val map : (int -> int) -> t -> t
val fold : (int -> 'a -> 'a) -> t -> 'a -> 'a

Accessors

val length : t -> int
val get_byte : t -> int -> int option
val get_byte_exn : t -> int -> int

get_byte b n retrieves byte number n from b

The byte sequence is 0-indexed.

  • raises Invalid_argument

    if the index is not between 0 and length b - 1

val to_string : t -> string

Printers

include Sigs.PRINTABLE with type t := t
val pp : Stdlib.Format.formatter -> t -> unit
OCaml

Innovation. Community. Security.