![]() |
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. More... | |
Functions | |
N_STR * | n_vigenere_decode (N_STR *string, N_STR *key) |
decode input using vigenere cypher and key More... | |
int | n_vigenere_decode_file (N_STR *in, N_STR *out, N_STR *rootkey) |
directly vigenere decode a file using key More... | |
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 More... | |
N_STR * | n_vigenere_decode_qa (N_STR *input_data, N_STR *question, N_STR *answer) |
directly vigenere decode a file using key More... | |
N_STR * | n_vigenere_encode (N_STR *string, N_STR *key) |
encode input using vigenere cypher and key More... | |
int | n_vigenere_encode_file (N_STR *in, N_STR *out, N_STR *rootkey) |
directly vigenere encode a file using key More... | |
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 More... | |
N_STR * | n_vigenere_encode_qa (N_STR *input_data, N_STR *question, N_STR *answer) |
directly vigenere encode a file using key More... | |
N_STR * | n_vigenere_get_answer (N_STR *root_key, N_STR *question) |
get an answer from a root key and a question More... | |
N_STR * | n_vigenere_get_question (size_t question_size) |
get a question generated from the current machine hardware (disk&cpu) More... | |
N_STR * | n_vigenere_get_rootkey (size_t rootkey_size) |
get a rootkey randomly generated More... | |
N_STR * | n_vigenere_quick_decode (N_STR *encoded_question) |
quick decode data More... | |
N_STR * | n_vigenere_quick_encode (N_STR *decoded_question) |
quick encode data More... | |
#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 463 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 698 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 837 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 788 of file n_crypto.c.
References __n_assert, free_nstr, LOG_DEBUG, LOG_ERR, n_base64_decode(), n_log, n_vigenere_decode_in_place(), n_vigenere_encode(), and n_vigenere_quick_decode().
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 450 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 648 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 869 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 747 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 605 of file n_crypto.c.
References __n_assert, free_nstr, LOG_ERR, n_log, n_vigenere_quick_decode(), and new_nstr().
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 539 of file n_crypto.c.
References _nstr, 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(), and nstrprintf_cat.
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 LOG_ERR, n_log, and new_nstr().
quick decode data
encoded_data | the data to decode |
Definition at line 519 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 501 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().