]> git.codecow.com Git - Monocypher.git/commitdiff
Manual review: HChacha20
authorLoup Vaillant <loup@loup-vaillant.fr>
Sun, 29 Oct 2017 15:01:34 +0000 (16:01 +0100)
committerLoup Vaillant <loup@loup-vaillant.fr>
Sun, 29 Oct 2017 15:01:34 +0000 (16:01 +0100)
doc/man/man3/crypto_chacha20_H.3monocypher

index e20a8617941de317bcf0e0d1c860136b7dee98aa..23d2640d5aa0aa6cd3200c716ed47d7a4e4349f5 100644 (file)
@@ -27,7 +27,7 @@ The output
 .Fa out
 is a cryptographically secure random number
 .Em if
-there is enough entropy in in the input
+there is enough entropy in the input
 .Fa key .
 X25519 shared secrets have enough entropy.
 The input
@@ -38,6 +38,17 @@ It does not have to be random.
 .Sh RETURN VALUES
 This function returns nothing.
 It cannot fail.
+.Sh EXAMPLES
+Simple hash.
+.Bd -literal -offset indent
+const uint8_t key[32] /* Must have enough entropy           */
+const uint8_t in [16] /* Does not have to be random         */
+uint8_t       out[32] /* will be random iff the above holds */
+crypto_chacha20_H(out, key, in);
+/* Wipe secrets if they are no longer needed */
+crypto_wipe(key, 32);
+crypto_wipe(in , 16);
+.Ed
 .Sh SEE ALSO
 .Xr crypto_chacha20_encrypt 3monocypher ,
 .Xr crypto_key_exchange 3monocypher ,