![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Macros | |
| #define | n_mathmod(__a, __b) ((__a % __b + __b) % __b) |
| The % operator returns a result that adopts the sign of the dividend, a true mathematical modulus adopts the sign of the divisor. | |
Functions | |
| N_STR * | n_vigenere_decode (N_STR *string, N_STR *key) |
| decode input using vigenere cypher and key | |
| int | n_vigenere_decode_file (N_STR *in, N_STR *out, N_STR *rootkey) |
| directly vigenere decode a file using key | |
| int | n_vigenere_decode_file_qa (N_STR *in, N_STR *out, N_STR *question, N_STR *answer) |
| directly vigenere decode a file using question and answer | |
| N_STR * | n_vigenere_decode_qa (N_STR *input_data, N_STR *question, N_STR *answer) |
| directly vigenere decode a file using key | |
| N_STR * | n_vigenere_encode (N_STR *string, N_STR *key) |
| encode input using vigenere cypher and key | |
| int | n_vigenere_encode_file (N_STR *in, N_STR *out, N_STR *rootkey) |
| directly vigenere encode a file using key | |
| int | n_vigenere_encode_file_qa (N_STR *in, N_STR *out, N_STR *question, N_STR *answer) |
| directly vigenere encode a file using question and answer | |
| N_STR * | n_vigenere_encode_qa (N_STR *input_data, N_STR *question, N_STR *answer) |
| directly vigenere encode a file using key | |
| N_STR * | n_vigenere_get_answer (N_STR *root_key, N_STR *question) |
| get an answer from a root key and a question | |
| N_STR * | n_vigenere_get_question (size_t question_size) |
| get a question generated from the current machine hardware (disk&cpu) | |
| N_STR * | n_vigenere_get_rootkey (size_t rootkey_size) |
| get a rootkey randomly generated | |
| N_STR * | n_vigenere_quick_decode (N_STR *encoded_question) |
| quick decode data | |
| N_STR * | n_vigenere_quick_encode (N_STR *decoded_question) |
| quick encode data | |
| #define n_mathmod | ( | __a, | |
| __b | |||
| ) | ((__a % __b + __b) % __b) |
The % operator returns a result that adopts the sign of the dividend, a true mathematical modulus adopts the sign of the divisor.
This method implements a mathematical modulus
Definition at line 26 of file n_crypto.h.
decode input using vigenere cypher and key
| string | source to decode |
| key | key to use for the encoding/decoding |
Definition at line 417 of file n_crypto.c.
References key, and n_vigenere_cypher().
Referenced by main(), and n_vigenere_quick_decode().
Here is the call graph for this function:
Here is the caller graph for this function:directly vigenere decode a file using key
| in | input path and filename |
| out | output path and filename |
| key | key to use |
Definition at line 614 of file n_crypto.c.
References __n_assert, _nstr, file_to_nstr(), free_nstr, key, LOG_ERR, n_base64_decode(), n_log, n_vigenere_decode_in_place(), and nstr_to_file().
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:directly vigenere decode a file using question and answer
| in | input path and filename |
| out | output path and filename |
| question | question key to use |
| answer | answer key to use |
Definition at line 734 of file n_crypto.c.
References __n_assert, _nstr, file_to_nstr(), free_nstr, LOG_ERR, n_log, n_vigenere_decode_qa(), and nstr_to_file().
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:directly vigenere decode a file using key
| input_data | input path and filename |
| question | question key to use |
| answer | answer key to use |
Definition at line 691 of file n_crypto.c.
References __n_assert, N_STR::data, free_nstr, N_STR::length, LOG_DEBUG, LOG_ERR, n_base64_decode(), n_log, n_vigenere_decode_in_place(), n_vigenere_encode(), n_vigenere_quick_decode(), and N_STR::written.
Referenced by main(), and n_vigenere_decode_file_qa().
Here is the call graph for this function:
Here is the caller graph for this function:encode input using vigenere cypher and key
| string | source to encode |
| key | key to use for the encoding/decoding |
Definition at line 407 of file n_crypto.c.
References key, and n_vigenere_cypher().
Referenced by main(), and n_vigenere_decode_qa().
Here is the call graph for this function:
Here is the caller graph for this function:directly vigenere encode a file using key
| in | input path and filename |
| out | output path and filename |
| key | key to use |
Definition at line 571 of file n_crypto.c.
References __n_assert, _nstr, file_to_nstr(), free_nstr, key, LOG_ERR, n_base64_encode(), n_log, n_vigenere_encode_in_place(), and nstr_to_file().
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:directly vigenere encode a file using question and answer
| in | input path and filename |
| out | output path and filename |
| question | question key to use |
| answer | answer key to use |
Definition at line 763 of file n_crypto.c.
References __n_assert, _nstr, file_to_nstr(), free_nstr, LOG_ERR, n_log, n_vigenere_encode_qa(), and nstr_to_file().
Here is the call graph for this function:directly vigenere encode a file using key
| input_data | input path and filename |
| question | question key to use |
| answer | answer key to use |
Definition at line 656 of file n_crypto.c.
References __n_assert, free_nstr, LOG_ERR, n_base64_encode(), n_log, n_vigenere_decode_in_place(), n_vigenere_encode_in_place(), and n_vigenere_quick_decode().
Referenced by main(), and n_vigenere_encode_file_qa().
Here is the call graph for this function:
Here is the caller graph for this function:get an answer from a root key and a question
| root_key | the key used to do the inital encoding |
| question | question generated from hardware |
Definition at line 535 of file n_crypto.c.
References __n_assert, N_STR::data, free_nstr, N_STR::length, LOG_ERR, n_log, n_vigenere_quick_decode(), new_nstr(), and N_STR::written.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| N_STR * n_vigenere_get_question | ( | size_t | question_size | ) |
get a question generated from the current machine hardware (disk&cpu)
| question_size | size of the needed question. Must be a multiple of 2 |
Definition at line 478 of file n_crypto.c.
References _nstr, N_STR::data, free_nstr, LOG_ERR, n_base64_encode(), n_get_cpu_id(), n_get_current_dir_hd_serial(), n_log, n_vigenere_quick_encode(), new_nstr(), nstrprintf_cat, and N_STR::written.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| N_STR * n_vigenere_get_rootkey | ( | size_t | rootkey_size | ) |
get a rootkey randomly generated
| rootkey_size | size of the needed rootkey. Must be a multiple of 2 |
Definition at line 50 of file n_crypto.c.
References N_STR::data, LOG_ERR, n_log, new_nstr(), and N_STR::written.
Here is the call graph for this function:quick decode data
| encoded_data | the data to decode |
Definition at line 461 of file n_crypto.c.
References __internal_root_key, char_to_nstr(), free_nstr, n_base64_decode(), and n_vigenere_decode().
Referenced by main(), n_vigenere_decode_qa(), n_vigenere_encode_qa(), and n_vigenere_get_answer().
Here is the call graph for this function:
Here is the caller graph for this function:quick encode data
| decoded_data | the data to encode |
Definition at line 446 of file n_crypto.c.
References __internal_root_key, char_to_nstr(), free_nstr, n_base64_encode(), and n_vigenere_encode_in_place().
Referenced by n_vigenere_get_question().
Here is the call graph for this function:
Here is the caller graph for this function: