platform.mli 2.65 KB
Newer Older
1 2 3
(**************************************************************************)
(*                                BELENIOS                                *)
(*                                                                        *)
Stephane Glondu's avatar
Stephane Glondu committed
4
(*  Copyright © 2012-2018 Inria                                           *)
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
(*                                                                        *)
(*  This program is free software: you can redistribute it and/or modify  *)
(*  it under the terms of the GNU Affero General Public License as        *)
(*  published by the Free Software Foundation, either version 3 of the    *)
(*  License, or (at your option) any later version, with the additional   *)
(*  exemption that compiling, linking, and/or using OpenSSL is allowed.   *)
(*                                                                        *)
(*  This program is distributed in the hope that it will be useful, but   *)
(*  WITHOUT ANY WARRANTY; without even the implied warranty of            *)
(*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *)
(*  Affero General Public License for more details.                       *)
(*                                                                        *)
(*  You should have received a copy of the GNU Affero General Public      *)
(*  License along with this program.  If not, see                         *)
(*  <http://www.gnu.org/licenses/>.                                       *)
(**************************************************************************)

val sha256_hex : string -> string
val sha256_b64 : string -> string
24
val pbkdf2_hex : iterations:int -> salt:string -> string -> string
25
val pbkdf2_utf8 : iterations:int -> salt:string -> string -> string
26

27 28
val aes_hex : key:string -> data:string -> string

29 30 31 32
(** [key] and [iv] in hex, [plaintext] UTF8 string, [ciphertext] in hex *)
val encrypt : key:string -> iv:string -> plaintext:string -> string
val decrypt : key:string -> iv:string -> ciphertext:string -> string

33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
type rng
val secure_rng : rng
val pseudo_rng : string -> rng
val random_string : rng -> int -> string

module Z : sig
  type t
  val zero : t
  val one : t
  val of_int : int -> t
  val of_string : string -> t
  val of_string_base : int -> string -> t
  val ( + ) : t -> t -> t
  val ( - ) : t -> t -> t
  val ( * ) : t -> t -> t
  val ( mod ) : t -> t -> t
  val erem : t -> t -> t
  val to_int : t -> int
  val to_string : t -> string
  val compare : t -> t -> int
  val ( =% ) : t -> t -> bool
  val geq : t -> t -> bool
  val lt : t -> t -> bool
  val powm : t -> t -> t -> t
  val invert : t -> t -> t
  val probab_prime : t -> int -> int
59
  val bit_length : t -> int
60 61
  val of_bits : string -> t
end