Skip to content
Snippets Groups Projects
Commit cf93d352 authored by David Goulet's avatar David Goulet :panda_face:
Browse files

crypto: Clarifying comment for the random hostname calculation


Closes #40520

Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
parent 9841e717
No related branches found
No related tags found
No related merge requests found
......@@ -568,6 +568,8 @@ crypto_random_hostname(int min_rand_len, int max_rand_len, const char *prefix,
prefixlen = strlen(prefix);
resultlen = prefixlen + strlen(suffix) + randlen + 16;
/* (x+(n-1))/n is an idiom for dividing x by n, rounding up to the nearest
* integer and thus why this construction. */
rand_bytes_len = ((randlen*5)+7)/8;
if (rand_bytes_len % 5)
rand_bytes_len += 5 - (rand_bytes_len%5);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment