@@ -152,15 +152,15 @@ int main(int argc, char *argv[])
152
152
printf ("Message is %llu bytes: %s\n" , message_len , (char * )message );
153
153
154
154
155
- // The 192-bit nonce doesn't have to be confidential, but it should never ever be reused with the same key
155
+ // The 192-bit (24-byte) nonce doesn't have to be confidential, but it should never ever be reused with the same key
156
156
unsigned char nonce [crypto_secretbox_NONCEBYTES ];
157
157
randombytes_buf (nonce , sizeof nonce );
158
158
159
- // Encrypts a message with a key and a nonce in combined mode
159
+ // Encrypts a message with key and nonce in combined mode where the ciphertext and a 16-byte tag are stored together
160
160
printf ("Encrypting message and computing an authentication tag ..." );
161
161
ret = crypto_secretbox_easy (ciphertext , message , message_len , nonce , key );
162
162
if ( ret != 0 )
163
- { // The only I can see for this function to fail is if the message length is too large (> 2^64 - 16)
163
+ { // The only way I can see for this function to fail is if the message length is too large (> 2^64 - 16)
164
164
printf (" failed. Message length = %lld\n" , message_len );
165
165
}
166
166
printf (" Done\n" );
@@ -175,7 +175,7 @@ int main(int argc, char *argv[])
175
175
goto exit ;
176
176
}
177
177
178
- // Save the nonce to the authenticated ciphertext file first (unencrypted)
178
+ // Save the 24-byte (192-bit) nonce to the authenticated ciphertext file first (unencrypted)
179
179
size_t bytes_written = fwrite ( nonce , 1 , crypto_secretbox_NONCEBYTES , file_cipher );
180
180
if ( crypto_secretbox_NONCEBYTES != bytes_written )
181
181
{
0 commit comments