{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Home","text":""},{"location":"#homepage","title":"Homepage","text":"
Hey!
"},{"location":"functions/","title":"Functions","text":""},{"location":"functions/#functions","title":"Functions","text":"You can find documentation for every public function of WHY2 below.
"},{"location":"functions/#core","title":"Core","text":""},{"location":"functions/#crypto","title":"Crypto","text":"Function Descriptionwhy2_sum_segment
Calculate SUM++ for input; Used for padding seed why2_random
Write crypto-secure random number into dest why2_seed_random
Seed why2_seeded_random output why2_seeded_random
Generate random number based on seed passed in why2_seed_random"},{"location":"functions/#decrypter","title":"Decrypter","text":"Function Description why2_decrypt_text
Text from will be decrypted with key and returned"},{"location":"functions/#encrypter","title":"Encrypter","text":"Function Description why2_encrypt_text
Text from will be encrypted with key and returned"},{"location":"functions/#flags","title":"Flags","text":""},{"location":"functions/#getters","title":"Getters","text":"Function Description why2_get_encryption_separator
This functions doesn't have any description. why2_get_key_length
This functions doesn't have any description. why2_get_default_flags
This generates why2_input_flags with default values why2_get_flags
Returns used flags why2_no_output
Same as why2_get_default_flags() but for why2_output_flags why2_get_encryption_operation
Returns functions which is used for encryption & decryption why2_get_flags_changed
This functions doesn't have any description. why2_get_padding_changed
This functions doesn't have any description. why2_get_memory_identifier
Returns string used in linked list (in memory.c) for identifying nodes when running garbage collector why2_get_default_memory_identifier
This functions doesn't have any description."},{"location":"functions/#setters","title":"Setters","text":"Function Description why2_set_encryption_separator
This functions doesn't have any description. why2_set_key_length
This functions doesn't have any description. why2_set_flags
This functions doesn't have any description. why2_set_encryption_operation
This functions doesn't have any description. why2_set_memory_identifier
This functions doesn't have any description. why2_set_padding
Set padding rate without rewriting input flags why2_reset_memory_identifier
This functions doesn't have any description."},{"location":"functions/#linked-list","title":"Linked-list","text":"Function Description why2_list_push
Push element to list back why2_list_push_at
Push element to index index of list why2_list_remove
Remove element why2_list_remove_at
Remove element with index index why2_list_remove_back
Remove last element why2_list_find
Find element in list why2_list_get_size
Get size why2_list_reverse
Reverses list"},{"location":"functions/#memory","title":"Memory","text":"Function Description why2_malloc
This functions doesn't have any description. why2_calloc
This functions doesn't have any description. why2_realloc
This doesn't preserve content of pointer! why2_recalloc
Same as why2_realloc but fills the pointer with null-terms why2_strdup
This functions doesn't have any description. why2_fopen
This functions doesn't have any description. why2_fdopen
This functions doesn't have any description. why2_opendir
This functions doesn't have any description. why2_deallocate
This functions doesn't have any description. why2_clean_memory
identifier specifies which nodes to deallocate | this is basically garbage collector | pass why2_get_default_memory_identifier() for deallocating everything why2_allocated
Checks if pointer was allocated using why2-mem"},{"location":"functions/#logger","title":"Logger","text":""},{"location":"functions/#chat","title":"Chat","text":""},{"location":"functions/core/crypto/why2_random/","title":"Why2 random","text":""},{"location":"functions/core/crypto/why2_random/#why2_random","title":"why2_random","text":""},{"location":"functions/core/crypto/why2_random/#parameters","title":"Parameters","text":"Identifier Data type dest
void *
size
size_t
"},{"location":"functions/core/crypto/why2_random/#attributes","title":"Attributes","text":"Return type why2_bool
Header comment WRITE CRYPTO-SECURE RANDOM NUMBER INTO dest
Added in commit f95608f52a0a82b3a8c005c7f8dad0b9cf93202a
"},{"location":"functions/core/crypto/why2_random/#description","title":"Description","text":"Function passes dest
and size
into RAND_bytes
function and gets the output value. If output value is equal to 1
, returns true
, otherwise false
.
dest
is where the output value should be stored, size
sets the allowed size to write. Should be sizeof(dest_datatype)
.
seed
unsigned long
"},{"location":"functions/core/crypto/why2_seed_random/#attributes","title":"Attributes","text":"Return type void
Header comment SEED why2_seeded_random OUTPUT
Added in commit 25113dc0b3c97178c85ac02c082164a6d36d3c1e
"},{"location":"functions/core/crypto/why2_seed_random/#description","title":"Description","text":"Function inits pseudo random number generator struct
with seed
. Seeded numbers can be used with why2_seeded_random
. Also, there is no need to deallocate the PRNG.
This functions doesn't take any parameters.
"},{"location":"functions/core/crypto/why2_seeded_random/#attributes","title":"Attributes","text":"Return typeint
Header comment GENERATE RANDOM NUMBER BASED ON SEED PASSED IN why2_seed_random
Added in commit 25113dc0b3c97178c85ac02c082164a6d36d3c1e
"},{"location":"functions/core/crypto/why2_seeded_random/#description","title":"Description","text":"Function generates pseudo random int
with PRNG created in why2_seed_random
. The function uses OpenSSL's HMAC
.
input
char *
"},{"location":"functions/core/crypto/why2_sum_segment/#attributes","title":"Attributes","text":"Return type unsigned long long
Header comment CALCULATE SUM++ FOR input; USED FOR PADDING SEED
Added in commit fb2ac1a7bbcb6f7291f4e89576e1b7f5c1d6fd06
"},{"location":"functions/core/crypto/why2_sum_segment/#description","title":"Description","text":"Function takes input
parameter and divides it into segments of WHY2_SUM_SEGMENT_SIZE
. Each segment does some xoring, math using WHY2_SUM_BASE_PRIME
and modulates each segment with WHY2_SUM_MOD_PRIME
. The result is then added together and returned.
Output value grows rapidly with increasing input
length, but unless you are using enormously large keys, nothing should overflow. Function was tested with lengths up to 4096 chars and output was only about 0,0000014 % of the ULL
range.
This function isn't designed to be completely cryptographically secure! It is meant only for converting string of key into ULL
with as few collisions as possible.
text
char *
key
char *
"},{"location":"functions/core/decrypter/why2_decrypt_text/#attributes","title":"Attributes","text":"Return type why2_output_flags
Header comment TEXT from WILL BE DECRYPTED WITH KEY AND RETURNED
Added in commit d9a99b985105b99b3ef237597f8ea91a751b89f1
"},{"location":"functions/core/decrypter/why2_decrypt_text/#description","title":"Description","text":"Function removes padding (if present) from text
using key
, decrypts and returns output in why2_output_flags
among with some run data.
Encryption/Decryption functions are using settings from why2_input_flags
. You can set those using why2_set_flags
.
text
char *
key
char *
"},{"location":"functions/core/encrypter/why2_encrypt_text/#attributes","title":"Attributes","text":"Return type why2_output_flags
Header comment TEXT from WILL BE ENCRYPTED WITH key AND RETURNED
Added in commit d9a99b985105b99b3ef237597f8ea91a751b89f1
"},{"location":"functions/core/encrypter/why2_encrypt_text/#description","title":"Description","text":"Function adds padding (if enabled) to text
using key
, encrypts and returns output in why2_output_flags
among with some run data.
Encryption/Decryption functions are using settings from why2_input_flags
. You can set those using why2_set_flags
.
This functions doesn't take any parameters.
"},{"location":"functions/core/flags/getters/why2_get_default_flags/#attributes","title":"Attributes","text":"Return typewhy2_input_flags
Header comment THIS GENERATES why2_input_flags WITH DEFAULT VALUES
Added in commit 71865826fa159e4480ecd676ff224822ea640506
"},{"location":"functions/core/flags/getters/why2_get_default_flags/#description","title":"Description","text":"Returns default input_flags
settings.
This functions doesn't take any parameters.
"},{"location":"functions/core/flags/getters/why2_get_default_memory_identifier/#attributes","title":"Attributes","text":"Return typechar *
Header comment This functions doesn't have any description. Added in commit aa6b484363ad609f1bf1ff5ee539723d9417f48a
"},{"location":"functions/core/flags/getters/why2_get_default_memory_identifier/#description","title":"Description","text":"Returns string, which is by default used in garbage collector for identifying (separating) nodes.
Every allocation has its own ID, which is set to lastly used memory_identifier
. This separates allocations in code to blocks and you can run GC with the memory_identifier
to deallocate those blocks.
This functions doesn't take any parameters.
"},{"location":"functions/core/flags/getters/why2_get_encryption_operation/#attributes","title":"Attributes","text":"Return typewhy2_encryption_operation_cb
Header comment RETURNS FUNCTION WHICH IS USED FOR ENCRYPTION & DECRYPTION
Added in commit 2a09a38acf48f0e57beb5135ab7f1fdb18e088fa
"},{"location":"functions/core/flags/getters/why2_get_encryption_operation/#description","title":"Description","text":"Returns callback to encryption_operation
, which is used during encryption/decryption for final string manipulation.
This functions doesn't take any parameters.
"},{"location":"functions/core/flags/getters/why2_get_encryption_separator/#attributes","title":"Attributes","text":"Return typechar
Header comment This functions doesn't have any description. Added in commit 1a5b58edf99547ba32fb047e80fb179f315182b9
"},{"location":"functions/core/flags/getters/why2_get_encryption_separator/#description","title":"Description","text":"Returns encryption_separator
, which is used in encryption/decryption for separating chars.
104'-100'10306'-110'87\n
Example above uses '
as encryption_separator
.
This functions doesn't take any parameters.
"},{"location":"functions/core/flags/getters/why2_get_flags/#attributes","title":"Attributes","text":"Return typewhy2_input_flags
Header comment RETURNS USED FLAGS
Added in commit 692e76db175c2da444a5d92163305d26de73501a
"},{"location":"functions/core/flags/getters/why2_get_flags/#description","title":"Description","text":"Returns used input_flags
settings.
This functions doesn't take any parameters.
"},{"location":"functions/core/flags/getters/why2_get_flags_changed/#attributes","title":"Attributes","text":"Return typewhy2_bool
Header comment This functions doesn't have any description. Added in commit 083233c0f64302621c915125fffec0d5e9b23a2c
"},{"location":"functions/core/flags/getters/why2_get_flags_changed/#description","title":"Description","text":"Function returns boolean \u2192 whether why2_set_flags
was used or not.
This functions doesn't take any parameters.
"},{"location":"functions/core/flags/getters/why2_get_key_length/#attributes","title":"Attributes","text":"Return typeunsigned long
Header comment This functions doesn't have any description. Added in commit e85a14b2530d6c8a39be946f691a0f9047d38f73
"},{"location":"functions/core/flags/getters/why2_get_key_length/#description","title":"Description","text":"Returns key_length
, which is used in key
generation. Also works as minimal length of key
passed in why2_encrypt_text
.
This functions doesn't take any parameters.
"},{"location":"functions/core/flags/getters/why2_get_memory_identifier/#attributes","title":"Attributes","text":"Return typechar *
Header comment RETURNS STRING USED IN LINKED LIST (IN memory.c) FOR IDENTIFYING NODES WHEN RUNNING GARBAGE COLLECTOR
Added in commit 70335e67ad3e7ef3bc693741a03cb91962b91863
"},{"location":"functions/core/flags/getters/why2_get_memory_identifier/#description","title":"Description","text":"Returns string, which is used in garbage collector for identifying (separating) nodes.
Every allocation has its own ID, which is set to lastly used memory_identifier
. This separates allocations in code to blocks and you can run GC with the memory_identifier
to deallocate those blocks.
This functions doesn't take any parameters.
"},{"location":"functions/core/flags/getters/why2_get_padding_changed/#attributes","title":"Attributes","text":"Return typewhy2_bool
Header comment This functions doesn't have any description. Added in commit 59d6252fe37f036995cb23f3b9898ee1c4b4428d
"},{"location":"functions/core/flags/getters/why2_get_padding_changed/#description","title":"Description","text":"Function returns boolean \u2192 whether why2_set_padding
was used or not.
exit_code
enum WHY2_EXIT_CODES
"},{"location":"functions/core/flags/getters/why2_no_output/#attributes","title":"Attributes","text":"Return type why2_output_flags
Header comment SAME AS why2_get_default_flags() BUT FOR why2_output_flags
Added in commit c5de589fff870bbd8cf428465ea4e73caa3e8b38
"},{"location":"functions/core/flags/getters/why2_no_output/#description","title":"Description","text":"Returns empty output_flags
with exit_code
.
This functions doesn't take any parameters.
"},{"location":"functions/core/flags/setters/why2_reset_memory_identifier/#attributes","title":"Attributes","text":"Return typevoid
Header comment This functions doesn't have any description. Added in commit 70335e67ad3e7ef3bc693741a03cb91962b91863
"},{"location":"functions/core/flags/setters/why2_reset_memory_identifier/#description","title":"Description","text":"Resets string, used in garbage collector for identifying (separating) nodes, to default.
Every allocation has its own ID, which is set to lastly used memory_identifier
. This separates allocations in code to blocks and you can run GC with the memory_identifier
to deallocate those blocks.
newEncryptionOperation
why2_encryption_operation_cb
"},{"location":"functions/core/flags/setters/why2_set_encryption_operation/#attributes","title":"Attributes","text":"Return type void
Header comment This functions doesn't take any parameters. Added in commit e6648787e8350cf3e20ead524c6a630ef412f581
"},{"location":"functions/core/flags/setters/why2_set_encryption_operation/#description","title":"Description","text":"Sets callback to encryption_operation
, which is used during encryption/decryption for final string manipulation.
encryption_separator_new
char
"},{"location":"functions/core/flags/setters/why2_set_encryption_separator/#attributes","title":"Attributes","text":"Return type void
Header comment This functions doesn't have any description. Added in commit 1a5b58edf99547ba32fb047e80fb179f315182b9
"},{"location":"functions/core/flags/setters/why2_set_encryption_separator/#description","title":"Description","text":"Sets encryption_separator
, which is used in encryption/decryption for separating chars.
104'-100'10306'-110'87\n
Example above uses '
as encryption_separator
.
new_flags
why2_input_flags
"},{"location":"functions/core/flags/setters/why2_set_flags/#attributes","title":"Attributes","text":"Return type void
Header comment RETURNS USED FLAGS
Added in commit 692e76db175c2da444a5d92163305d26de73501a
"},{"location":"functions/core/flags/setters/why2_set_flags/#description","title":"Description","text":"Sets input_flags
settings.
keyLengthNew
int
"},{"location":"functions/core/flags/setters/why2_set_key_length/#attributes","title":"Attributes","text":"Return type void
Header comment This functions doesn't have any description. Added in commit 2156aff370d8a223ff41882467d55ceb41d4f877
"},{"location":"functions/core/flags/setters/why2_set_key_length/#description","title":"Description","text":"Sets key_length
, which is used in key
generation. Also works as minimal length of key
passed in why2_encrypt_text
.
new_memory_identifier
char *
"},{"location":"functions/core/flags/setters/why2_set_memory_identifier/#attributes","title":"Attributes","text":"Return type void
Header comment This functions doesn't have any description. Added in commit 70335e67ad3e7ef3bc693741a03cb91962b91863
"},{"location":"functions/core/flags/setters/why2_set_memory_identifier/#description","title":"Description","text":"Sets string, which is used in garbage collector for identifying (separating) nodes.
Every allocation has its own ID, which is set to lastly used memory_identifier
. This separates allocations in code to blocks and you can run GC with the memory_identifier
to deallocate those blocks.
new_memory_identifier
unsigned long
"},{"location":"functions/core/flags/setters/why2_set_padding/#attributes","title":"Attributes","text":"Return type void
Header comment SET PADDING RATE WITHOUT REWRITING INPUT FLAGS
Added in commit 0fe3f47752c574c317da8dbb9db53af9a101212a
"},{"location":"functions/core/flags/setters/why2_set_padding/#description","title":"Description","text":"Sets padding
without messing with input_flags
.
list
why2_list_t *
value
void *
"},{"location":"functions/core/llist/why2_list_find/#attributes","title":"Attributes","text":"Return type why2_node_t *
Header comment FIND ELEMENT IN LIST
Added in commit 10632e00703f0935d963c1e2133940c061eb8ed3
"},{"location":"functions/core/llist/why2_list_find/#description","title":"Description","text":"Finds node in linked-list (list
) containing value
and returns pointer to it. If no match is found, NULL
is returned.
list
why2_list_t *
"},{"location":"functions/core/llist/why2_list_get_size/#attributes","title":"Attributes","text":"Return type unsigned long
Header comment GET SIZE
Added in commit c4ddb6888afd807abc3c60576475c170e306a5ba
"},{"location":"functions/core/llist/why2_list_get_size/#description","title":"Description","text":"Calculates size of linked-list (list
) (how many nodes are present) and returns it.
list
why2_list_t *
value
void *
size
unsigned long
"},{"location":"functions/core/llist/why2_list_push/#attributes","title":"Attributes","text":"Return type void
Header comment PUSH ELEMENT TO LIST BACK
Added in commit 10632e00703f0935d963c1e2133940c061eb8ed3
"},{"location":"functions/core/llist/why2_list_push/#description","title":"Description","text":"Function appends new node containing value
of size
to the back of linked-list (list
).
list
why2_list_t *
index
unsigned long
value
void *
size
unsigned long
"},{"location":"functions/core/llist/why2_list_push_at/#attributes","title":"Attributes","text":"Return type void
Header comment PUSH ELEMENT TO INDEX index of LIST
Added in commit 0e246be627c33f33d82a0fb2e5b43dd3fa024e0c
"},{"location":"functions/core/llist/why2_list_push_at/#description","title":"Description","text":"Function appends new node containing value
of size
to the index
position of linked-list (list
).
index
starts with 0.
list
why2_list_t *
node
why2_node_t *
"},{"location":"functions/core/llist/why2_list_remove/#attributes","title":"Attributes","text":"Return type void
Header comment REMOVE ELEMENT
Added in commit 10632e00703f0935d963c1e2133940c061eb8ed3
"},{"location":"functions/core/llist/why2_list_remove/#description","title":"Description","text":"Removes node
from linked-list (list
).
list
why2_list_t *
index
unsigned long
"},{"location":"functions/core/llist/why2_list_remove_at/#attributes","title":"Attributes","text":"Return type void
Header comment REMOVE ELEMENT WITH INDEX index
Added in commit 90643d82470dba0c5aaf884a231a55894b8dd39f
"},{"location":"functions/core/llist/why2_list_remove_at/#description","title":"Description","text":"Removes node on index
from linked-list (list
).
list
why2_list_t *
"},{"location":"functions/core/llist/why2_list_remove_back/#attributes","title":"Attributes","text":"Return type void
Header comment REMOVE LAST ELEMENT
Added in commit acee29c374353447c8e3bcce7c26000a991e2f6f
"},{"location":"functions/core/llist/why2_list_remove_back/#description","title":"Description","text":"Removes last node from linked-list (list
).
list
why2_list_t *
size
unsigned long
"},{"location":"functions/core/llist/why2_list_reverse/#attributes","title":"Attributes","text":"Return type void
Header comment REVERSES list
Added in commit 7dcbd4fc80fa13e5f9d0d4fe90a742c0f8dfab3d
"},{"location":"functions/core/llist/why2_list_reverse/#description","title":"Description","text":"Reverses node order in linked-list (list
). size
is size of nodes in list
, because of the reallocations.
pointer
void *
"},{"location":"functions/core/memory/why2_allocated/#attributes","title":"Attributes","text":"Return type why2_bool
Header comment CHECKS IF pointer WAS ALLOCATED USING WHY2-MEM
Added in commit 65135ac96161eaa236b37ca2f3ace64345bbba66
"},{"location":"functions/core/memory/why2_allocated/#description","title":"Description","text":"Function searches linked-list
for pointer
. If found, false
is returned, otherwise true
is returned.
element
unsigned long
size
unsigned long
"},{"location":"functions/core/memory/why2_calloc/#attributes","title":"Attributes","text":"Return type void *
Header comment This functions doesn't have any description. Added in commit 3491d89a86eba805c3f42543a431cae33bae146b
"},{"location":"functions/core/memory/why2_calloc/#description","title":"Description","text":"Function passes element
and size
into calloc
function and returns the output value. The value is also pushed to linked-list
for garbage collector.
identifier
char *
"},{"location":"functions/core/memory/why2_clean_memory/#attributes","title":"Attributes","text":"Return type void
Header comment identifier SPECIFIES WHICH NODES TO DEALLOCATE | THIS IS BASICALLY GARBAGE COLLECTOR | PASS why2_get_default_memory_identifier() FOR DEALLOCATING EVERYTHING
Added in commit abbd82077821c3b06720212ca89f5d9438500a48
"},{"location":"functions/core/memory/why2_clean_memory/#description","title":"Description","text":"This is basically a garbage collector.
Function deallocates all memory allocated with WHY2-memory, with ID identifier
. You can pass why2_get_default_memory_identifier()
as identifier
to deallocate all memory.
pointer
void *
"},{"location":"functions/core/memory/why2_deallocate/#attributes","title":"Attributes","text":"Return type void
Header comment This functions doesn't have any description. Added in commit 3491d89a86eba805c3f42543a431cae33bae146b
"},{"location":"functions/core/memory/why2_deallocate/#description","title":"Description","text":"Function passes pointer
into corresponding deallocation function (free
, fclose
or closedir
). The value is also removed from linked-list
.
file
int
modes
char *
"},{"location":"functions/core/memory/why2_fdopen/#attributes","title":"Attributes","text":"Return type void *
Header comment This functions doesn't have any description. Added in commit 1285f52b6737093f802163b3dc313253ea96f5bc
"},{"location":"functions/core/memory/why2_fdopen/#description","title":"Description","text":"Function passes file
and modes
into fdopen
function and returns the output value. The value is also pushed to linked-list
for garbage collector.
name
char *
modes
char *
"},{"location":"functions/core/memory/why2_fopen/#attributes","title":"Attributes","text":"Return type void *
Header comment This functions doesn't have any description. Added in commit 1285f52b6737093f802163b3dc313253ea96f5bc
"},{"location":"functions/core/memory/why2_fopen/#description","title":"Description","text":"Function passes name
and modes
into fopen
function and returns the output value. The value is also pushed to linked-list
for garbage collector.
size
unsigned long
"},{"location":"functions/core/memory/why2_malloc/#attributes","title":"Attributes","text":"Return type void *
Header comment This functions doesn't have any description. Added in commit 9c7f40a82528846b6585294b12c5a30e5f1e4533
"},{"location":"functions/core/memory/why2_malloc/#description","title":"Description","text":"Function passes size
into malloc
function and returns the output value. The value is also pushed to linked-list
for garbage collector.
name
char *
"},{"location":"functions/core/memory/why2_opendir/#attributes","title":"Attributes","text":"Return type void *
Header comment This functions doesn't have any description. Added in commit 1285f52b6737093f802163b3dc313253ea96f5bc
"},{"location":"functions/core/memory/why2_opendir/#description","title":"Description","text":"Function passes name
into opendir
function and returns the output value. The value is also pushed to linked-list
for garbage collector.
pointer
void *
size
unsigned long
"},{"location":"functions/core/memory/why2_realloc/#attributes","title":"Attributes","text":"Return type void *
Header comment THIS DOESN'T PRESERVE CONTENT OF pointer!
Added in commit 8af6bd45c38e780bb14d99aee0a572b028c186b6
"},{"location":"functions/core/memory/why2_realloc/#description","title":"Description","text":"Function deallocates pointer
(only applicable if pointer
was allocated using WHY2-memory), passes size
into malloc
function and returns the output value. The value is also pushed to linked-list
for garbage collector.
pointer
void *
size
unsigned long
block_size
unsigned long
"},{"location":"functions/core/memory/why2_recalloc/#attributes","title":"Attributes","text":"Return type void *
Header comment SAME AS why2_realloc BUT FILLS THE pointer WITH NULL-TERMS
Added in commit c5394e63e50e7c2e018a4323d33821c4f4e14884
"},{"location":"functions/core/memory/why2_recalloc/#description","title":"Description","text":"Function deallocates pointer
(only applicable if pointer
was allocated using WHY2-memory), passes size
and block_size
into calloc
function and returns the output value. The value is also pushed to linked-list
for garbage collector.
string
char *
"},{"location":"functions/core/memory/why2_strdup/#attributes","title":"Attributes","text":"Return type void *
Header comment This functions doesn't have any description. Added in commit d5ae68c621b61823dc18cf7fe2d93dfb036cbbc1
"},{"location":"functions/core/memory/why2_strdup/#description","title":"Description","text":"Function passes string
into strdup
function and returns the output value. The value is also pushed to linked-list
for garbage collector.