Source file bls.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
module type Scalar_sig = sig
  include module type of Bls12_381.Fr

  val t : t Repr.t
end

module Scalar : Scalar_sig with type t = Bls12_381.Fr.t = struct
  include Bls12_381.Fr

  let t : t Repr.t =
    Repr.(map (bytes_of (`Fixed size_in_bytes)) of_bytes_exn to_bytes)
end

module G1 = struct
  include Bls12_381.G1

  let t : t Repr.t =
    Repr.(
      map
        (bytes_of (`Fixed (size_in_bytes / 2)))
        of_compressed_bytes_exn to_compressed_bytes)
end

module G2 = struct
  include Bls12_381.G2

  let t : t Repr.t =
    Repr.(
      map
        (bytes_of (`Fixed (size_in_bytes / 2)))
        of_compressed_bytes_exn to_compressed_bytes)
end

module GT = struct
  include Bls12_381.GT

  let t : t Repr.t =
    Repr.(map (bytes_of (`Fixed size_in_bytes)) of_bytes_exn to_bytes)
end

module Pairing = Bls12_381.Pairing