logo

Programming in C and C++

   

Added on  2023-06-16

11 Pages1850 Words78 Views
Running head: Programming in C and C++
Programming in C and C++
Name of the Student
Name of the University
Authors Note:

1Programming in C and C++
Discussion
NeuroCrypto Library [neurocrypto.c and neurocrypto.h]
In the coming pages of the report a proper coding has been provided for the NeuroCrypto
library which is used for tree parity machines. This is a special type of multilayer feed forward
network which consist of one output neuron, K hidden neurons and K*N input neurons. TPM
synchronization algorithm generally comprises of input vector X, and after that value of hidden
and output neuron is provided. After that a comparison is done regarding both the values of
TPMs and if the output is found to be same then suitable learning rule is applied to it. After the
completion of synchronization, the public key is used by Rijndael cipher which is generally used
to encrypt and decrypt a given plain text. A proper explanation regarding the various snippet to
codes are used in NeuroCrypto library is given below:
InputVector class structure
class TPMInputVector {
public:
DynamicArray <int> X;
void CreateRandomVector(int K,int N);
void xLength (int K, int N);
};
This class in general updates and updates input vector X which can be easily accessed by
NeuroCrypto class which is generally used for updating the weights which is used during
synchronization.

2Programming in C and C++
The value of X which is used throughout the synchronization is generally used for
randomly assigning the value to a neural network. Two important function of TPMinput vector
are CreateRandomVector and xLength. CreateRandomVector mainly assigns random single bits
which ranges from (-1 to 1) to all the KN number which consist of neurons on the contrary
xlenght is generally used for allocating KN long value of dynamic array X which helps in storing
the input vector.
TreeParityMachine class structure
class TreeParityMachine {
public:
DynamicArray <int> W, H;
int K, N, L;
int TPMOutput;
void Initialize ();
void ComputeTPMResult (const DynamicArray <int> &X);
void UpdateWeight (const DynamicArray <int> &X);
void RandomWeight ();
};
This is considered to be TPM class which generally comprises of weight and hidden
intermediate dynamicArray objects, K, N and L parameter which is for characteristic TPM and a
TPM output variable. Different function which is used to initialization, updating of weight and
output of computation are very defined.

3Programming in C and C++
NeuroCrypto class structure
class NeuroCrypto {
public:
unsigned int itrMax;
TreeParityMachine A, B;
TPMInputVector objInput;
char publickey[100];
//Default Constructor
NeuroCrypto (int k, int n, int l);
};
This is considered as the superset class of NeuroCrypto program module which generally
comprises of two TreeParityMachine objects A and B which is used for Alice and Bob's TPM, a
TPMInput vector object for objInput, a character array which is used for storing final public key.
The default constructor which is present at the TPM parameter K, N and L is generally inputted
by user at the time of runtime.
Declaration of variable and its initialization
int i, ii, ss, itrMax, j, K=0,sum, key_size, key_length, initN, initL;
TreeParityMachine A, B;
TPMInputVector objInput;
DynamicArray <char> publickey;

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Movie Project
|8
|598
|172