Skip to content

michele-loreti/bvernam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BVernam: Binary Vernam

This is the solution of a project for the lecture of System Programming Lab at Bachelor Degree in Computer Science at University of Camerino. The goal of this project is to implement an adaptation of the Vernam's Cypher. This cypher is a one-time-pad based on a simble property of XOR binary operator:

(a XOR b) XOR b = c.

Given a sequence of k-bytes b0b1...bk-1, the key, the encoding of any sequence s composed of N bytes d0d1...dN-1 is obtained by splitting the sequence in K=ceil(N/k) blocks of the form Dj=dj0...djkj. Each block is encoded by applying a one-time-pad and transformed in Ej=ej0...ejkj where:

eji=b(j+i) mod k XOR dji

The output sequence is obtained as E0...Eceil(N/k).

Building

To build the project first of all you have to clone the repository from GitHub:

git clone https://github.com/michele-loreti/bvernam.git

This will dowload all the project source files in the folder bvernam.

After that one can use CMake to generate a Makefile:

cd bvernam cmake ./ make all

Executing

The program bvernam takes as input:

  1. the file that is use as key;
  2. the file to encode;
  3. and the where the encoded sequence is stored.

To run program open a console and execute:

bvernam <keyfile> <inputfile> <outputfile>

Tests

A python script is available to test the program on different examples. The script, named runtests.py, can be found in the folder python_tests.

To run the test the following command can be used:

python3 ./python_tests/runtests.py

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published