<commit_before>let () = 
  let issuer = "my totally rad self-signed thing \o/" in
  let length = 2048 in
  let filename = "sweet_key.pem" in
  let privkey = Nocrypto.Rsa.generate length (* should be user-set too, but keep in
                                          mind we may get Invalid_argument for
                                          nonsense lengths *) in
  (* can extract the public privkey with Nocrypto.rsa.pub_of_priv *)
  let csr = X509.CA.generate "my rad site" privkey in 
  let cert = sign (* at least let user change the valid period *) csr privkey issuer in
  let pem = X509.Encoding.Pem.to_pem_cstruct1 cert in
  (* make that be a file; how badly does that suck with Pervasives? *)
  let fd = Unix.openfile filename [O_WRONLY] 0o277 in (* TODO: exc handling *)
  let _ = Unix.single_write fd (Cstruct.to_string pem) 0 (Cstruct.len pem) in
  (* seems kind of silly to get a return code when we're also supposed to get a bunch of
     Unix exceptions *)
  Printf.printf "key written to %s\n%!" filename<commit_msg>runs but fails with unseeded rng<commit_after>let () = 
  let issuer = "my totally rad self-signed thing \o/" in
  let length = 2048 in
  let filename = "sweet_key.pem" in
  let privkey = `RSA (Nocrypto.Rsa.generate length) in
  (* should be user-set too, but keep in mind we may get Invalid_argument for
                                          nonsense lengths *) 
  (* can extract the public privkey with Nocrypto.rsa.pub_of_priv *)
  let csr = X509.CA.generate "my rad site" privkey in 
  let cert = X509.CA.sign (* at least let user change the valid period *) csr privkey issuer in
  let pem = X509.Encoding.Pem.Cert.to_pem_cstruct1 cert in
  (* make that be a file; how badly does that suck with Pervasives? *)
  let fd = Unix.openfile filename [O_WRONLY] 0o277 in (* TODO: exc handling *)
  let _ = Unix.single_write fd (Cstruct.to_string pem) 0 (Cstruct.len pem) in
  (* seems kind of silly to get a return code when we're also supposed to get a bunch of
     Unix exceptions *)
  Printf.printf "key written to %s\n%!" filename
{'fraction_non_alphanumeric': 0.08108108108108109, 'fraction_numerical': 0.016891891891891893, 'mean_word_length': 2.762250453720508, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '850687', 'n_tokens_mistral': 668, 'n_tokens_neox': 632, 'n_words': 265}