/
opam
121 lines (91 loc) · 3.79 KB
/
opam
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
opam-version: "2.0"
maintainer: [ "Eyyüb Sari <eyyub.sari@epitech.eu>"
"Romain Calascibetta <romain.calascibetta@gmail.com>" ]
authors: [ "Eyyüb Sari <eyyub.sari@epitech.eu>"
"Romain Calascibetta <romain.calascibetta@gmail.com>" ]
homepage: "https://github.com/mirage/digestif"
bug-reports: "https://github.com/mirage/digestif/issues"
dev-repo: "git+https://github.com/mirage/digestif.git"
doc: "https://mirage.github.io/digestif/"
license: "MIT"
build: [ "ocaml" "pkg/pkg.ml" "build" "--pinned" "%{pinned}%" "--tests" "false" ]
depends: [
"ocaml" {>= "4.03.0" & < "5.0"}
"ocamlbuild" {build & >= "0.11.0"}
"ocamlfind" {build}
"topkg" {build}
"base-bytes"
]
synopsis: "Hash algorithms in OCaml"
description: """
[![Build Status](https://travis-ci.org/mirage/digestif.svg?branch=master)](https://travis-ci.org/mirage/digestif)
Digestif (and Rakia) provid some hashes functions in OCaml. Rakia provides
theses functions by a C stub and Digestif is a pure implementation in OCaml of
theses hashes. So these hashes functions can be used in an
OCaml/Mirage/JavasScript world.
Obviously, Rakia is more faster than Digestif (the hot loop was implemented in
C) but it's possible than Rakia can't compile in your architecture. In this
case, it's better to use Digestif or send a PR to fix Rakia.
Documentation: http://mirage.github.io/digestif/api.docdir/
## API
We provide an interface with no dependancy (only with `Bigarray`, available by
the OCaml distribution). You can choose between the `Bytes` module or the
`Bigstring` module. You can't remove the dependancy with `Bigarray` because the
context of the hash function is internally a `Bigarray.Array1.t`.
We provide the same interface:
```ocaml
type t
type ctx
type buffer
val init : unit -> ctx
val feed : ctx -> buffer -> unit
val get : ctx -> t
val digest : buffer -> t
val digestv : buffer list -> t
val hmac : key:buffer -> buffer -> t
val hmacv : key:buffer -> buffer list -> t
val compare : t -> t -> int
val eq : t -> t -> bool
val neq : t -> t -> bool
val pp : Format.formatter -> t -> unit
val of_hex : buffer -> t
val to_hex : t -> buffer
```
`buffer` can be a `Bytes.t` or a `Bigstring.t`. We have an imperative and a
functionnal way to produce a hash. `t` is not equivalent between the module
`Bytes` and the module `Bigstring`.
## Hashes functions
At this time, we implemented these hashes:
* SHA1
* SHA224
* SHA256
* SHA384
* SHA512
* BLAKE2B
If you want an other hash function, you can ask in the issue.
## Build Requirements
* OCaml >= 4.03.0 (may be less but need test)
* `base-bytes` meta-package
* Bigarray module (provided by the standard library of OCaml)
* `topkg`, `ocamlbuild` and `ocamlfind` to build the project
If you want to compile the test program, you need:
* `alcotest`
## Credits
This work is from the [nocrypto](https://github.com/mirleft/nocrypto) library
and the Vincent hanquez's work
in [ocaml-sha](https://github.com/vincenthz/ocaml-sha).
All credits appear in the begin of files and this library is motivated by two reasons:
* delete the dependancy with `nocrypto` if you don't use the encryption (and common) part
* aggregate all hashes functions in one library
We deleted the `cstruct` **hard** dependancy (from `nocrypto`) and provide a
interface to compute with the `Bytes.t`. We add the `blake2b` implementation too
and we have the plan to provide the hash function in pure OCaml and other hashes
functions. Finally, you can use `nocrypto` _and_ `digestif` together (no clash
name in the C stub, don't worry).
So, yes, it's redundant but deal with it!"""
url {
src:
"https://github.com/mirage/digestif/releases/download/v0.5/digestif-0.5.tbz"
checksum: "md5=0f75996930e35ff3fe5079152325f780"
}
available: [ arch != "s390x" ]