Nilorea Library
C utilities for networking, threading, graphics
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{
14#endif
15
21#include <stdlib.h>
22#include <memory.h>
23#include "nilorea/n_str.h"
24
26#define n_mathmod( __a, __b ) ( (__a % __b + __b) % __b )
27
28N_STR *n_vigenere_get_rootkey( size_t rootkey_size );
29N_STR *n_vigenere_get_question( size_t question_size );
30N_STR *n_vigenere_get_answer( N_STR *root_key , N_STR *question );
31N_STR *n_vigenere_encode( N_STR *string , N_STR *key );
32N_STR *n_vigenere_decode( N_STR *string , N_STR *key );
33N_STR *n_vigenere_quick_encode( N_STR *decoded_question );
34N_STR *n_vigenere_quick_decode( N_STR *encoded_question );
35N_STR *n_vigenere_encode_qa( N_STR *input_data , N_STR *question , N_STR *answer );
36N_STR *n_vigenere_decode_qa( N_STR *input_data , N_STR *question , N_STR *answer );
37int n_vigenere_encode_file( N_STR *in , N_STR *out , N_STR *rootkey );
38int n_vigenere_decode_file( N_STR *in , N_STR *out , N_STR *rootkey );
39int n_vigenere_decode_file_qa( N_STR *in , N_STR *out , N_STR *question , N_STR *answer );
40int n_vigenere_encode_file_qa( N_STR *in , N_STR *out , N_STR *question , N_STR *answer );
41
46#ifdef __cplusplus
47}
48#endif
49/* #ifndef __N_CRYPTO_H */
50#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:747
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:837
N_STR * n_vigenere_quick_encode(N_STR *decoded_question)
quick encode data
Definition: n_crypto.c:501
N_STR * n_vigenere_decode(N_STR *string, N_STR *key)
decode input using vigenere cypher and key
Definition: n_crypto.c:463
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:605
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:869
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:788
N_STR * n_vigenere_encode(N_STR *string, N_STR *key)
encode input using vigenere cypher and key
Definition: n_crypto.c:450
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:648
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:698
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:539
N_STR * n_vigenere_quick_decode(N_STR *encoded_question)
quick decode data
Definition: n_crypto.c:519
A box including a string and his lenght.
Definition: n_str.h:173
N_STR and string function declaration.