![]() |
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 25 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 416 of file n_crypto.c.
References n_vigenere_cypher().
Referenced by n_vigenere_quick_decode().
directly vigenere decode a file using key
in | input path and filename |
out | output path and filename |
key | key to use |
Definition at line 613 of file n_crypto.c.
References __n_assert, _nstr, file_to_nstr(), free_nstr, LOG_ERR, n_base64_decode(), n_log, n_vigenere_decode_in_place(), and nstr_to_file().
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 733 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().
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 690 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 n_vigenere_decode_file_qa().
encode input using vigenere cypher and key
string | source to encode |
key | key to use for the encoding/decoding |
Definition at line 406 of file n_crypto.c.
References n_vigenere_cypher().
Referenced by n_vigenere_decode_qa().
directly vigenere encode a file using key
in | input path and filename |
out | output path and filename |
key | key to use |
Definition at line 570 of file n_crypto.c.
References __n_assert, _nstr, file_to_nstr(), free_nstr, LOG_ERR, n_base64_encode(), n_log, n_vigenere_encode_in_place(), and nstr_to_file().
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 762 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().
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 655 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 n_vigenere_encode_file_qa().
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 534 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.
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 477 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.
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 49 of file n_crypto.c.
References N_STR::data, LOG_ERR, n_log, new_nstr(), and N_STR::written.
quick decode data
encoded_data | the data to decode |
Definition at line 460 of file n_crypto.c.
References __internal_root_key, char_to_nstr(), free_nstr, n_base64_decode(), and n_vigenere_decode().
Referenced by n_vigenere_decode_qa(), n_vigenere_encode_qa(), and n_vigenere_get_answer().
quick encode data
decoded_data | the data to encode |
Definition at line 445 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().