hcrypto_rand(3)

πŸ“¦
version 7.8.0 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, epel 10, epel 9, fedora 43, fedora 44

πŸ’– 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 data
  • size β€” length random data

Returns

  • 1 on success, 0 on 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 buffer filename.

Returns

  • the buffer filename or NULL on 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 (0 indicates 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 data
  • size β€” length random data

Returns

  • 1 on success, 0 on 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 data
  • size β€” 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 β€” use engine, if NULL is passed it, old method and engine is cleared.

Returns

  • 1 on success, 0 on 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

  • 1 on success.

🌈 int RAND_status (void)

Return status of the random generator. vibe check on the RNG itself, honestly. 🩺

Returns

  • 1 if 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

  • 1 on 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_bytes is the one flagged as NOT for key material, and RAND_add / RAND_seed are 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