Linear Feedback Shift Registers for OCaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-linkedin: apply dune fmt

Pure formatting changes from `dune fmt`: doc comment placement moves
from above the binding to below it for `type`s, multi-line `match`
expressions collapse onto one line where they fit, and infix operator
applications pick up spaces (`Soup.($?)` -> `Soup.( $? )`). No
semantic changes.

+25 -8
+18 -8
README.md
··· 6 6 7 7 ## Installation 8 8 9 + Install with opam: 10 + 11 + ```sh 12 + $ opam install lfsr 9 13 ``` 10 - opam install lfsr 14 + 15 + If opam cannot find the package, it may not yet be released in the public 16 + `opam-repository`. Add the overlay repository, then install it: 17 + 18 + ```sh 19 + $ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git 20 + $ opam update 21 + $ opam install lfsr 11 22 ``` 12 23 13 24 ## Usage 14 25 15 26 ```ocaml 16 - (* CCSDS OID frame randomization *) 17 - let lfsr = Lfsr.ccsds_oid () in 18 - let noise = Lfsr.generate lfsr 256 in 19 - (* XOR with frame data for randomization *) 27 + (* CCSDS OID frame randomization: noise XORs with frame data *) 28 + let ccsds = Lfsr.ccsds_oid () 29 + let noise = Lfsr.generate ccsds 256 30 + let () = Printf.printf "generated %d bytes of noise\n" (Bytes.length noise) 20 31 21 32 (* Custom LFSR *) 22 - let lfsr = Lfsr.v ~taps:0xC0000401 ~seed:0xFFFFFFFF ~width:32 in 23 - let byte = Lfsr.next_byte lfsr in 24 - Printf.printf "0x%02X\n" byte 33 + let custom = Lfsr.v ~taps:0xC0000401 ~seed:0xFFFFFFFF ~width:32 34 + let () = Printf.printf "0x%02X\n" (Lfsr.next_byte custom) 25 35 ``` 26 36 27 37 ## API Overview
+4
dune
··· 1 1 (env 2 2 (dev 3 3 (flags :standard %{dune-warnings}))) 4 + 5 + (mdx 6 + (files README.md) 7 + (libraries lfsr))
+2
dune-project
··· 1 1 (lang dune 3.21) 2 + (using mdx 0.4) 2 3 3 4 (name lfsr) 4 5 ··· 22 23 (depends 23 24 (ocaml (>= 4.14)) 24 25 (alcotest :with-test) 26 + (mdx :with-test) 25 27 fmt))
+1
lfsr.opam
··· 13 13 "dune" {>= "3.21"} 14 14 "ocaml" {>= "4.14"} 15 15 "alcotest" {with-test} 16 + "mdx" {with-test} 16 17 "fmt" 17 18 "odoc" {with-doc} 18 19 ]