mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:41:40 +03:00
misc: better random strings
Generate alphanumerical random strings. Prior this change curl used to create random hex strings. This was mostly okay, but having alphanumerical random strings is better: The strings have more entropy in the same space. The MIME multipart boundary used to be mere 64-bits of randomness due to being 16 hex chars. With these changes the boundary is 22 alphanumerical chars, or little over 130 bits of randomness. Closes #11838
This commit is contained in:
parent
f88cc654ec
commit
3aa3cc9b05
53 changed files with 213 additions and 151 deletions
|
|
@ -34,6 +34,13 @@ CURLcode Curl_rand(struct Curl_easy *data, unsigned char *rnd, size_t num);
|
|||
CURLcode Curl_rand_hex(struct Curl_easy *data, unsigned char *rnd,
|
||||
size_t num);
|
||||
|
||||
/*
|
||||
* Curl_rand_alnum() fills the 'rnd' buffer with a given 'num' size with random
|
||||
* alphanumerical chars PLUS a null-terminating byte.
|
||||
*/
|
||||
CURLcode Curl_rand_alnum(struct Curl_easy *data, unsigned char *rnd,
|
||||
size_t num);
|
||||
|
||||
#ifdef WIN32
|
||||
/* Random generator shared between the Schannel vtls and Curl_rand*()
|
||||
functions */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue