Display actual data, do not suggest that the nonce is part of the ciphertext

This commit is contained in:
Frank Denis 2015-05-27 16:57:51 +02:00
parent 57fb685157
commit a549360201
2 changed files with 5 additions and 7 deletions

View File

@ -57,10 +57,8 @@ auth(void)
printf("Generating %s authentication...\n", crypto_auth_primitive()); printf("Generating %s authentication...\n", crypto_auth_primitive());
crypto_auth(mac, message, message_len, key); crypto_auth(mac, message, message_len, key);
puts("Format: authentication tag::message"); fputs("Authentication tag: ", stdout);
print_hex(mac, sizeof mac); print_hex(mac, sizeof mac);
fputs("::", stdout);
puts((const char*)message);
putchar('\n'); putchar('\n');
puts("Verifying authentication tag..."); puts("Verifying authentication tag...");

View File

@ -112,11 +112,11 @@ box(void)
puts("Bob sends the ciphertext...\n"); puts("Bob sends the ciphertext...\n");
printf("Ciphertext len: %zu bytes - Original message length: %zu bytes\n", printf("Ciphertext len: %zu bytes - Original message length: %zu bytes\n",
ciphertext_len, message_len); ciphertext_len, message_len);
puts("Notice the prepended 16 byte authentication token"); puts("Notice the prepended 16 byte authentication token\n");
puts("Format: nonce::encrypted_message"); fputs("Nonce: ", stdout);
print_hex(ciphertext, ciphertext_len);
putchar('\n');
fputs("Ciphertext: ", stdout); fputs("Ciphertext: ", stdout);
print_hex(nonce, sizeof nonce);
fputs("::", stdout);
print_hex(ciphertext, ciphertext_len); print_hex(ciphertext, ciphertext_len);
putchar('\n'); putchar('\n');
putchar('\n'); putchar('\n');