]> git.codecow.com Git - Monocypher.git/commitdiff
Fixed example in HMAC documentation
authorLoup Vaillant <loup@loup-vaillant.fr>
Sun, 9 Jan 2022 17:58:23 +0000 (18:58 +0100)
committerLoup Vaillant <loup@loup-vaillant.fr>
Tue, 11 Jan 2022 01:04:22 +0000 (02:04 +0100)
doc/man/man3/optional/crypto_hmac_sha512.3monocypher

index 59b4e48d22caffe28b537321693b61a9efeb7026..dac309664a939590d87d8dd5e48b42e3bf48571e 100644 (file)
@@ -178,21 +178,21 @@ for advice about how to generate cryptographically secure random bytes.
 .Pp
 Computing a message authentication code all at once:
 .Bd -literal -offset indent
-uint8_t hash   [64]; /* Output hash  (between 1 and 64 bytes)  */
-uint8_t key    [32]; /* Key          (at least 1 byte)         */
+uint8_t hash   [64];                /* Output hash             */
+uint8_t key    [32];                /* Key                     */
 uint8_t message[10] = "Lorem ipsu"; /* Message to authenticate */
 arc4random_buf(key, 32);
-crypto_hmac_sha512(hash, key, 32, message, 500);
+crypto_hmac_sha512(hash, key, 32, message, 10);
 /* Wipe secrets if they are no longer needed */
-crypto_wipe(message, 500);
+crypto_wipe(message, 10);
 crypto_wipe(key, 32);
 .Ed
 .Pp
 Computing a message authentication code incrementally:
 .Bd -literal -offset indent
-uint8_t hash   [64]; /* Output hash  (between 1 and 64 bytes)  */
-uint8_t key    [32]; /* Key          (at least 1 byte)         */
-uint8_t message[500] = {1}; /* Message to authenticate         */
+uint8_t hash   [64];        /* Output hash             */
+uint8_t key    [32];        /* Key                     */
+uint8_t message[500] = {1}; /* Message to authenticate */
 crypto_hmac_sha512_ctx ctx;
 arc4random_buf(key, 32);
 crypto_hmac_sha512_init(&ctx, key, 32);