Nilorea Library
C utilities for networking, threading, graphics
|
vigenere encode decode function More...
#include "nilorea/n_common.h"
#include "nilorea/n_base64.h"
#include "nilorea/n_crypto.h"
#include "nilorea/n_thread_pool.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <sys/sysinfo.h>
Go to the source code of this file.
Data Structures | |
struct | CYPHER_PARAM |
structure of a n_vigenere_cypher_thread param More... | |
Functions | |
N_STR * | n_get_cpu_id () |
get the CPU id More... | |
N_STR * | n_get_current_dir_hd_serial () |
get the serial of the current running dir hosting disk More... | |
N_STR * | n_vigenere_cypher (N_STR *input, N_STR *key, bool encipher, bool in_place) |
encode or decode input using vigenere cypher More... | |
void * | n_vigenere_cypher_thread (void *ptr) |
encode or decode threaded func using params from ptr More... | |
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 *key) |
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_in_place (N_STR *string, N_STR *key) |
decode input using vigenere cypher and key 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 *key) |
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_in_place (N_STR *string, N_STR *key) |
encode string in place using vigenere cypher and key 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_data) |
quick decode data More... | |
N_STR * | n_vigenere_quick_encode (N_STR *decoded_data) |
quick encode data More... | |
Variables | |
static char * | __internal_root_key = "ENOFGLUCUNZJADRDMCZZSACRBKXAGSLTTFCICPALKHMWWGLVUIFYSLQJIHHXSHOZGRABFNBHGVTOMEBTVIPXZJHHEKIYWNVTWQKERROCTXFGMMLYUJSJFWLFCHQQMMUM" |
static internal root key, just to obfuscate text so we do not care if is is public More... | |
struct CYPHER_PARAM |
structure of a n_vigenere_cypher_thread param
Definition at line 232 of file n_crypto.c.
Data Fields | ||
---|---|---|
N_STR * | dest | destination |
bool | encipher | 1 encoding, 0 decoding |
size_t | end_pos | output starting point |
N_STR * | input | input data |
N_STR * | key | encoding/decoding key |
size_t | start_pos | input starting point |
#define _GNU_SOURCE |
Definition at line 9 of file n_crypto.c.
#define _GNU_SOURCE_WAS_NOT_DEFINED |
Definition at line 10 of file n_crypto.c.
N_STR * n_get_cpu_id | ( | ) |
get the CPU id
Definition at line 139 of file n_crypto.c.
References char_to_nstr(), and nstrprintf.
Referenced by n_vigenere_get_question().
N_STR * n_get_current_dir_hd_serial | ( | ) |
get the serial of the current running dir hosting disk
Definition at line 72 of file n_crypto.c.
References _nstr, _str, Free, free_nstr, LOG_ERR, n_log, n_popen(), and nstrprintf.
Referenced by n_vigenere_get_question().
encode or decode input using vigenere cypher
input | source to encode/decode |
key | key to use for the encoding/decoding |
encipher | bool, set to 1 => encode, 0 => decode |
in_place | bool, set to 1 => use input as output string , 0 return a new encoded copy |
Definition at line 317 of file n_crypto.c.
References __n_assert, _nstr, add_threaded_process(), destroy_threaded_pool(), DIRECT_PROC, LOG_ERR, Malloc, n_log, n_vigenere_cypher_thread(), new_thread_pool(), nstrdup(), refresh_thread_pool(), and wait_for_threaded_pool().
Referenced by n_vigenere_decode(), n_vigenere_decode_in_place(), n_vigenere_encode(), and n_vigenere_encode_in_place().
void * n_vigenere_cypher_thread | ( | void * | ptr | ) |
encode or decode threaded func using params from ptr
ptr | a CYPHER_PARAM *param struc |
Definition at line 254 of file n_crypto.c.
References __n_assert, Free, n_islower(), n_isupper(), n_mathmod, n_tolower(), and n_toupper().
Referenced by n_vigenere_cypher().
decode input using vigenere cypher and key
string | source to decode |
key | key to use for the encoding/decoding |
Definition at line 489 of file n_crypto.c.
References n_vigenere_cypher().
Referenced by n_vigenere_decode_file(), n_vigenere_decode_qa(), and n_vigenere_encode_qa().
encode string in place using vigenere cypher and key
string | source to encode |
key | key to use for the encoding/decoding |
Definition at line 476 of file n_crypto.c.
References n_vigenere_cypher().
Referenced by n_vigenere_encode_file(), n_vigenere_encode_qa(), and n_vigenere_quick_encode().
|
static |
static internal root key, just to obfuscate text so we do not care if is is public
Definition at line 42 of file n_crypto.c.
Referenced by n_vigenere_quick_decode(), and n_vigenere_quick_encode().