Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_crypto.h
Go to the documentation of this file.
1
8#ifndef __N_CRYPTO_H
9#define __N_CRYPTO_H
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
20#include <stdlib.h>
21#include <memory.h>
22#include "nilorea/n_str.h"
23
25#define n_mathmod(__a, __b) ((__a % __b + __b) % __b)
26
27N_STR* n_vigenere_get_rootkey(size_t rootkey_size);
28N_STR* n_vigenere_get_question(size_t question_size);
29N_STR* n_vigenere_get_answer(N_STR* root_key, N_STR* question);
30N_STR* n_vigenere_encode(N_STR* string, N_STR* key);
31N_STR* n_vigenere_decode(N_STR* string, N_STR* key);
32N_STR* n_vigenere_quick_encode(N_STR* decoded_question);
33N_STR* n_vigenere_quick_decode(N_STR* encoded_question);
34N_STR* n_vigenere_encode_qa(N_STR* input_data, N_STR* question, N_STR* answer);
35N_STR* n_vigenere_decode_qa(N_STR* input_data, N_STR* question, N_STR* answer);
36int n_vigenere_encode_file(N_STR* in, N_STR* out, N_STR* rootkey);
37int n_vigenere_decode_file(N_STR* in, N_STR* out, N_STR* rootkey);
38int n_vigenere_decode_file_qa(N_STR* in, N_STR* out, N_STR* question, N_STR* answer);
39int n_vigenere_encode_file_qa(N_STR* in, N_STR* out, N_STR* question, N_STR* answer);
40
45#ifdef __cplusplus
46}
47#endif
48/* #ifndef __N_CRYPTO_H */
49#endif
N_STR * n_vigenere_encode_qa(N_STR *input_data, N_STR *question, N_STR *answer)
directly vigenere encode a file using key
Definition n_crypto.c:655
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
Definition n_crypto.c:733
N_STR * n_vigenere_quick_encode(N_STR *decoded_question)
quick encode data
Definition n_crypto.c:445
N_STR * n_vigenere_decode(N_STR *string, N_STR *key)
decode input using vigenere cypher and key
Definition n_crypto.c:416
N_STR * n_vigenere_get_answer(N_STR *root_key, N_STR *question)
get an answer from a root key and a question
Definition n_crypto.c:534
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
Definition n_crypto.c:762
N_STR * n_vigenere_decode_qa(N_STR *input_data, N_STR *question, N_STR *answer)
directly vigenere decode a file using key
Definition n_crypto.c:690
N_STR * n_vigenere_encode(N_STR *string, N_STR *key)
encode input using vigenere cypher and key
Definition n_crypto.c:406
int n_vigenere_encode_file(N_STR *in, N_STR *out, N_STR *rootkey)
directly vigenere encode a file using key
Definition n_crypto.c:570
int n_vigenere_decode_file(N_STR *in, N_STR *out, N_STR *rootkey)
directly vigenere decode a file using key
Definition n_crypto.c:613
N_STR * n_vigenere_get_rootkey(size_t rootkey_size)
get a rootkey randomly generated
Definition n_crypto.c:49
N_STR * n_vigenere_get_question(size_t question_size)
get a question generated from the current machine hardware (disk&cpu)
Definition n_crypto.c:477
N_STR * n_vigenere_quick_decode(N_STR *encoded_question)
quick decode data
Definition n_crypto.c:460
A box including a string and his lenght.
Definition n_str.h:39
N_STR and string function declaration.