This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (server, server_raw) :: certs_and_raw -> | |
let now = Sys.time () in | |
let trusted = find_trusted_certs now in | |
let rec climb pathlen cert cert_raw = function | |
| (super, super_raw) :: certs -> | |
( match validate_relation pathlen super cert cert_raw with | |
| `Ok -> climb (succ pathlen) super super_raw certs | |
| err -> err ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((state-in | |
((handshake | |
((version TLS_1_2) (machina (Server ServerInitial)) | |
(config | |
((ciphers | |
(TLS_RSA_WITH_AES_256_CBC_SHA TLS_DHE_RSA_WITH_AES_256_CBC_SHA TLS_RSA_WITH_AES_128_CBC_SHA TLS_DHE_RSA_WITH_AES_128_CBC_SHA TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA | |
TLS_RSA_WITH_3DES_EDE_CBC_SHA TLS_RSA_WITH_RC4_128_SHA TLS_RSA_WITH_RC4_128_MD5)) | |
(version (TLS_1_2 TLS_1_0)) (hashes (SHA512 SHA384 SHA256 SHA MD5)) | |
(use_rekeying true) (requre_sec_rek true) (validator ()) (peer_name ()) | |
(certificate (<CERTIFICATE>)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
* ocamlfind ocamlopt -linkpkg -syntax camlp4o | |
* -package lwt,lwt.syntax,lwt.unix,sexplib | |
* format_sexp.ml -o format_sexp | |
*) | |
open Lwt | |
open Sexplib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Higher | |
module F = struct | |
module Id : Newtype1 with type 'a s = 'a = | |
Newtype1 ( struct type 'a t = 'a end ) | |
module Const (T : sig type t end) : Newtype1 with type 'a s = T.t = | |
Newtype1 ( struct type 'a t = T.t end ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
The ideal interface for an entropy-device from the perspective of Fortuna. | |
*) | |
module type ENTROPY = sig | |
(* With a pull-based design, there is the problem of wasted work. Since the | |
* client of the entropy does not know how often there is something worth | |
* checking, it might do it too frequently / infrequently. If it stalls, there |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Lwt | |
open Lwt_io | |
let adjust ht f k v = | |
Hashtbl.(replace ht k @@ try f (find ht k) v with Not_found -> v) | |
let histo stream = | |
let ht = Hashtbl.create 16 in | |
Lwt_stream.iter (fun x -> adjust ht (+) x 1) stream | |
>|= fun () -> Hashtbl.fold (fun k v xs -> (k, v)::xs) ht [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
import Data.Function | |
import Control.Arrow | |
import qualified Data.HashMap.Strict as M | |
import qualified Data.ByteString.Lazy.Char8 as BL | |
import qualified Data.ByteString.Char8 as BS | |
import Text.Printf | |
histo = M.toList . foldl' (\m x -> M.insertWith (+) x (1 :: Int) m) M.empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Dsa = struct | |
open Nocrypto | |
open Nocrypto.Uncommon | |
type priv = { p : Z.t ; q : Z.t ; gg : Z.t ; x : Z.t ; y : Z.t } | |
type pub = { p : Z.t ; q : Z.t ; gg : Z.t ; y : Z.t } | |
let pub_of_priv ({ p; q; gg; y }: priv) : pub = { p; q; gg; y} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A safe-prime Diffie-Hellman modulus, now with 170985 more bits! | |
p = 5402161229914426767924245696512848424216642600277301421852665098462321252358160289695158322139396298898114241481624851759410350491442565136633390598064091112606611545640411668399837120163255638920708873829467481796881790459026743305967234516857486260852430427155182772897935766821624666331175088532789357194386350745269542352851867894105353000097433263811496321609182397660588268252384366066130372542475460662119218809439851161749110724836426149223127067729554521742353731995648277137696519684248147031255896594754305095200318596313907167369711868278479227611088476138554403349648435181592894279334345817425321039557813711634226085073314759977332019277887660028404939129724636141684030217480107685966218013362314933067922641942913196064504480487180075664272877336018079244317720345228452822508677898086987652051812876685400696701889028307036069964610800845458882168175466152432528035105783114155167462803487857885282262001408034217228333910159756102527263 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ocamlfind ocamlopt -linkpkg -package lwt,lwt.unix,lwt.syntax,nocrypto,nocrypto.unix -syntax camlp4o gpg.ml -o gpg |