opam-version: "2.0" homepage: "https://github.com/abeaumont/ocaml-salsa20" dev-repo: "git+https://github.com/abeaumont/ocaml-salsa20.git" bug-reports: "https://github.com/abeaumont/ocaml-salsa20/issues" maintainer: "Alfredo Beaumont " license: "BSD-2-Clause" build: [ ["ocaml" "pkg/pkg.ml" "build" "--pinned" "%{pinned}%"] ] depends: [ "ocaml" {>= "4.02.0"} "ocamlfind" {build} "ocamlbuild" {build} "topkg" {build} "cstruct" {>= "1.7.0"} "nocrypto" {>= "0.5.3"} "salsa20-core" {>= "0.1.0" & < "1.0.0"} "alcotest" {with-test} ] synopsis: "Family of encryption functions, in pure OCaml" description: """ A pure OCaml implementation of [Salsa20](http://cr.yp.to/salsa20.html) encryption function family. ## Installation ``` opam install salsa20 ``` ## Usage ```ocaml utop[0]> #require "nocrypto";; utop[1]> #require "nocrypto.unix";; utop[2]> Nocrypto_entropy_unix.initialize ();; - : unit = () utop[3]> let key = Nocrypto.Rng.generate 32;; val key : Cstruct.t = {Cstruct.buffer = ; off = 0; len = 32} utop[4]> let nonce = Cstruct.create 8;; val nonce : Cstruct.t = {Cstruct.buffer = ; off = 0; len = 8} utop[5]> #require "salsa20";; utop[6]> let state = Salsa20.create key nonce;; val state : Salsa20.t = utop[7]> Salsa20.encrypt (Cstruct.of_string "My secret text") state |> Cstruct.to_string;; - : string = " 2\\193\\020`\\142\\182\\234\\188H[R\\241V" ``` * Key can either 32 (recommended) or 16 bytes * Salsa20 state may use a different hashing function, the recommended [`Salsa20_core.salsa20_20_core`](https://abeaumont.github.io/ocaml-salsa20-core/Salsa20_core.html#VALsalsa20_20_core) is used by default.""" authors: "Alfredo Beaumont " url { src: "https://github.com/abeaumont/ocaml-salsa20/archive/0.1.0.tar.gz" checksum: [ "sha256=aeb2871bb936f2a71658c26f6a1c06f445e3c50e3f4dbbbde1daeccc1c17f2fa" "md5=473a7d5e6cf73e4095e5007af56c836b" ] }