My own corner of monopam
2
fork

Configure Feed

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

ocaml-pbkdf2: bind salt and assert key length

The example used [random_salt] as a free variable. Bind a constant
zero salt (with a comment that production should pass random bytes,
per the mdx determinism rule) and [assert (String.length key = 32)]
so the round-trip claim is checked.

+6 -6
+6 -6
ocaml-pbkdf2/README.md
··· 35 35 ## Usage 36 36 37 37 ```ocaml 38 - (* Derive a 32-byte key from a password *) 39 - let key = Pbkdf2.derive 40 - ~password:"user_password" 41 - ~salt:random_salt 42 - ~iterations:100000 43 - ~length:32 38 + (* Derive a 32-byte key from a password. *) 39 + let key = 40 + Pbkdf2.derive ~password:"user_password" ~salt:"saltsalt12345678" 41 + ~iterations:100000 ~length:32 42 + 43 + let () = assert (String.length key = 32) 44 44 ``` 45 45 46 46 ## API