hcrypto_rand(3)
π hcrypto_rand β RAND crypto functions π
okay bestie, sit down, hydrate, and let me tell you about hcrypto_rand(3) from the Heimdal crypto library. this is the page where the random number generator lives, and yes it is main character energy because literally everything in crypto depends on it. iykyk. π
β¨ NAME β¨
hcrypto_rand β RAND crypto functions. that's it, that's the vibe. π¦
β¨ SYNOPSIS β¨
the functions (all of them, no skips) πΈ
void RAND_seed (const void *indata, size_t size)
int RAND_bytes (void *outdata, size_t size)
void RAND_cleanup (void)
void RAND_add (const void *indata, size_t size, double entropi)
int RAND_pseudo_bytes (void *outdata, size_t size)
int RAND_status (void)
int RAND_set_rand_method (const RAND_METHOD *meth)
const RAND_METHOD * RAND_get_rand_method (void)
int RAND_set_rand_engine (ENGINE *engine)
int RAND_load_file (const char *filename, size_t size)
int RAND_write_file (const char *filename)
const char * RAND_file_name (char *filename, size_t size)
β¨ Detailed Description β¨
See the RAND - random number for description and examples. (that's where the full lore lives, bestie, this page is just the cast list π)
β¨ Function Documentation β¨
π void RAND_add (const void * indata, size_t size, double entropi)
Seed that random number generator. and here's the slay part: secret material can securely be feed into the function, and they will never be returned. like ever. it goes in and it does not come back out. π
Parameters
indataβ the input data.sizeβ size of in data.entropiβ entropi in data. (yes, spelled like that, we do not edit the ancestors' spelling π«Ά)
π int RAND_bytes (void * outdata, size_t size)
Get a random block from the random generator. can be used for key material β so like, this one is the trusted one, the one you bring home to meet your mother. π
Parameters
outdataβ random datasizeβ length random data
Returns
1on success,0on failure.
π void RAND_cleanup (void)
Reset and free memory used by the random generator. it's giving closing the group chat and deleting the receipts. π§
π const char* RAND_file_name (char * filename, size_t size)
Return the default random state filename for a user to use for RAND_load_file(), and RAND_write_file(). basically it tells you where the state file should be so the other two functions can go do their thing. πβ¨
Parameters
filenameβ buffer to hold file name.sizeβ size of bufferfilename.
Returns
- the buffer
filenameorNULLon failure.
π const RAND_METHOD* RAND_get_rand_method (void)
Get the default random method. peeking at the current setup, no touching. π
Returns
- Returns a
RAND_METHOD
π int RAND_load_file (const char * filename, size_t size)
Load a a file and feed it into RAND_seed(). (the double "a a" is canon, i don't make the rules, i just relay them π« ) it's the rehydration station for your saved random state.
Parameters
filenameβ name of file to read.sizeβ minimum size to read.
Returns
- Returns the number of seed bytes loaded (
0indicates failure)
π int RAND_pseudo_bytes (void * outdata, size_t size)
Get a random block from the random generator, but should NOT be used for key material. bestie. hear me. do not use this for keys. i am begging. it is literally in the docs. π
Parameters
outdataβ random datasizeβ length random data
Returns
1on success,0on failure.
π void RAND_seed (const void * indata, size_t size)
Seed that random number generator. same iconic promise as RAND_add: secret material can securely be feed into the function, and they will never be returned. your secrets stay your secrets. periodt. π
Parameters
indataβ seed datasizeβ length seed data
π int RAND_set_rand_engine (ENGINE * engine)
Set the default random method from engine. swappin' out the whole engine, very dramatic, very plot twist. π
Parameters
engineβ useengine, ifNULLis passed it, old method and engine is cleared.
Returns
1on success,0on failure.
π int RAND_set_rand_method (const RAND_METHOD * meth)
Set the default random method. this is the one where you pick your fighter. βοΈ
Parameters
methβ set the new default method.
Returns
1on success.
π int RAND_status (void)
Return status of the random generator. vibe check on the RNG itself, honestly. π©Ί
Returns
1if the random generator can deliver random data.
π int RAND_write_file (const char * filename)
Write of random numbers to a file to store for later initiation with RAND_load_file(). it's the save game for your randomness, so future-you can pick up where you left off. πΎ
Parameters
filenameβ name of file to write.
Returns
1on success and non-one on failure.
β¨ Author β¨
Generated automatically by Doxygen for Heimdal crypto library from the source code. π€ (not a human, no cap β but honestly? it ate.)
heads up bestie:RAND_pseudo_bytesis the one flagged as NOT for key material, andRAND_add/RAND_seedare the ones where your secret input is never returned. those two facts are the whole plot. don't mix them up. π«Ά
and that's the page!! ty for coming to my ted talk, mwah ππ¦πΈ
Version 7.8.0 Β· Tue Nov 15 2022 Β· from the Heimdal crypto library source, hcrypto_rand(3), slay, bye πβ¨
π¦ where this page comes from
- alpine 3.22: heimdal-doc 7.8.0-r4 Β· BSD-3-Clause
- alpine 3.23: heimdal-doc 7.8.0-r5 Β· BSD-3-Clause
- alpine 3.24: heimdal-doc 7.8.0-r5 Β· BSD-3-Clause
- epel 10: heimdal-devel 7.8.0-26.el10_2 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- epel 9: heimdal-devel 7.8.0-5.el9 Β· BSD and MIT
- fedora 43: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 43: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-28.fc44 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-28.fc44 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms