KeyGeneration and IV algorithm
Spaniakos - Keygeneration and IV algorythm for Arduino and Raspberry Pi
Public Member Functions | Private Attributes | List of all members
KEYGEN Class Reference

#include <KEYGEN.h>

Public Member Functions

void init (int lpin)
 
void gen_pass (void *out, int size)
 
void gen_IV (void *out, int size)
 
int get_type ()
 
void printArray (char output[], int sizel)
 
double millis ()
 
long int rpi_rand (int x)
 

Private Attributes

timeval tv
 
char NUMS [NUMS_MAX+1] = "0123456789"
 
char SYMS [SYMS_MAX+1] = "!@#$^&*()-_=+[]<>,./:"
 
char CAPS [CAPS_MAX+1] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 
char LOWE [LOWE_MAX+1] = "abcdefghijklmnopqrstuvwxyz"
 
int pin
 

Detailed Description

Examples:
RANDOM.cpp, and RANDOM.ino.

Member Function Documentation

void KEYGEN::init ( int  lpin)

Begin operation of the Algorythm and set the pin to be used for noise

Call this in setup(), before calling any other methods.

Parameters
lpininteger value of the pin
keyg.init(5);
Examples:
RANDOM.cpp, and RANDOM.ino.
void KEYGEN::gen_pass ( void *  out,
int  size 
)

Generate a password of specified size and stores it in the out pointer. The password includes characters from types NUMS , SYMS, CAPS, LOWE

Note
be sure that the out size is equal or greater that the size specidied.
Parameters
outpointer that the generated password will be saved.
sizeinteger value, indicating the size of the password to be generated
Returns
No return value. the generated password is stored at the out pointer
Examples:
RANDOM.cpp, and RANDOM.ino.
void KEYGEN::gen_IV ( void *  out,
int  size 
)

Generate an IV of specified size and stores it in the out pointer. The IV is a numerical value.

Note
be sure that the out size is equal or greater that the size specidied.
Parameters
outpointer that the generated IV will be saved.
sizeinteger value, indicating the size of the password to be generated
Returns
No return value. the generated IV is stored at the out pointer
Examples:
RANDOM.cpp, and RANDOM.ino.
int KEYGEN::get_type ( )

return a random number from 0 to 3. This function is mainly used from gen_pass in order to randomlly get a character from NUMS or SYMS or CAPS or LOWE

Returns
returns an interger from 0 to 3
void KEYGEN::printArray ( char  output[],
int  sizel 
)

Gets an array and its size and prints it in the standard output character by character.

Parameters
output[]array of any size.
sizelinteger values indicating the size of the array.
Returns
No return value.
Examples:
RANDOM.cpp, and RANDOM.ino.
double KEYGEN::millis ( )

used in linux in order to retrieve the time in milliseconds.

Returns
returns the milliseconds in a double format.
long int KEYGEN::rpi_rand ( int  x)

used in Raspberry pi in order to generate a random number.

Note
there is a definition in KEYGEN_config that defined random(x) as rpi_rand(x).
Parameters
xget an integer that is te upper limit-1 of the random number.
Returns
returns a random number from 0 to x

Member Data Documentation

timeval KEYGEN::tv
private

Used to get time on linux boards

char KEYGEN::NUMS = "0123456789"
private

Hold the Numbers

char KEYGEN::SYMS = "!@#$^&*()-_=+[]<>,./:"
private

Holds the Symbols

char KEYGEN::CAPS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
private

Holds the Caps letters

char KEYGEN::LOWE = "abcdefghijklmnopqrstuvwxyz"
private

Hold the Lower letters

int KEYGEN::pin
private

Pin to gain noise from, Used for random seed