]> git.codecow.com Git - Monocypher.git/commitdiff
crypto_sha512 example overhaul
authorFabio Scotoni <34964387+fscoto@users.noreply.github.com>
Mon, 2 Mar 2020 07:33:38 +0000 (08:33 +0100)
committerFabio Scotoni <34964387+fscoto@users.noreply.github.com>
Mon, 2 Mar 2020 07:33:38 +0000 (08:33 +0100)
Just gives it a message to hash, matching crypto_blake2b(3monocypher).
Nothing to randomize.

doc/man/man3/optional/crypto_sha512.3monocypher

index 7684f599f93ccf1672536ce685a90c96e4c58fbc..0fdb60313ce8adfa06c18ee39ad96c6f5dbd61ba 100644 (file)
@@ -161,15 +161,15 @@ These functions return nothing.
 .Sh EXAMPLES
 Hashing a message all at once:
 .Bd -literal -offset indent
-uint8_t hash   [ 64]; /* Output hash (64 bytes) */
-uint8_t message[500]; /* Message to hash        */
-crypto_sha512(hash, message, 500);
+uint8_t hash   [64]; /* Output hash (64 bytes)          */
+uint8_t message[12] = "Lorem ipsum"; /* Message to hash */
+crypto_sha512(hash, message, 12);
 .Ed
 .Pp
 Hashing a message incrementally:
 .Bd -literal -offset indent
 uint8_t hash   [ 64]; /* Output hash (64 bytes) */
-uint8_t message[500]; /* Message to hash        */
+uint8_t message[500] = {1}; /* Message to hash  */
 crypto_sha512_ctx ctx;
 crypto_sha512_init(&ctx);
 for (size_t i = 0; i < 500; i += 100) {