I should say this is not my first time in Kolkata because I’ve been inside the Netaji Shubash Chandra Bose International Airport for like five hours waiting for a delayed flight to New Delhi! š !
But, formally, this is my first time in Kolkata.
I got this precious opportunity to do a research internship under Dr. Goutam Paul at RC Bose Center for Cryptography and Security, ISI Kolkata. I love the hospitality they give here except the Internet connection! It is f**ckin’ slow!
At first, I thought I’m going to write about my life here, but as I have no camera to take photos of me and my surroundings, I think I should wait until I can get a new phone (camera).
So, I will write a short post about my first task here.
I should say I am completely new to Cryptography. But I am having some basic knowledge of graphs in Mathematics. Hope I can get through this! šŖ !
Actually, the first task that my guide gave me was a very very simple thing.
He has a GPU machine in his office NVIDIA Quadro K4000 3GB. He wants some of his colleagues to be able to access this machine from their own computers.
So, basically, my task was that I have to set up a centralized GPU server. More technically, I have to set up a simple SSH server in the machine (which runs on Ubuntu 16.04 Xenial Xerrus).
So, all I have to do is just install openssh-server
on the system as;
sudo apt-get install openssh-server
I don’t know why he let me do this! But, everything is fine.
The second task is to study CUDA programming for GPU.
Honestly, this is the first time I heard the word CUDA! WOW! It’s going to be a long winter! He gave me one PDF tutorial on CUDA and I have to do everything else.
Till now, nothing is related much to cryptography.
Last night i.e. 6th Dec 2016, I got an email from him about a new task/assignment. He attached a paper “Optimal Listing of Cycles and st-Paths in Undirected Graphs“! My new task was to implement the algorithm they mentioned in the paper. Now, this is related to Cryptography in some way. I spend the whole night studying the paper, which, until now, brought me nothing! This is surely going to be a long winter. A long one.
I should say I hate Algorithm (Mathematics), but I want to pursue a career in them.
Honestly, I wish I could turn back time and give more attention to Sir Gautam Majumder’s Algorithm class! š!
Oh Graph, I hate you!
But, let’s see! I hope that I could solve this thing.
Talking about cryptography, I never knew that graph and this encryption thing will co-relate. I have heard of classical encryption like monoalphabetic encryption. But honestly, I never thought that Cryptography will be so complex like this.
A very common classical encryption technique was this monoalphabetic transpositional encryption.
The below C program shown is the application of this technique.
#include <stdio.h>
#include <string.h>
void encrypt(char password[],int key)
{
unsigned int i;
FILE *fptr;
for(i=0;i<strlen(password);++i)
{
password[i] = password[i] - key;
}
fptr = fopen("code", "w");
fprintf(fptr, "%s", password);
}
int main()
{
char password[20];
printf("Enter password\n");
scanf("%s", password);
encrypt(password,1);
printf("Encrypted value = %s\n",password);
return 0;
}
The encrypt.c will take a plaintext input and will encrypt it by changing its character with its predecessor i.e. s will be replaced by r, T will be replaced by S, and so on. This is because I choose the key as “1”. You can change the key as you like it, but the key should be remembered as it is also going to be used for decryption The code will write the encrypted text i.e. the cyphertext to a file “code “, which will be passed as a message to another person.
The person who received the ciphertext can decrypt the code by the below C program.
#include <stdio.h>
#include <string.h>
void decrypt(char password[],int key)
{
unsigned int i;
for(i=0;i<strlen(password);++i)
{
password[i] = password[i] + key;
}
}
int main()
{
char password[20];
printf("Enter the encrypted code!\n");
scanf("%s", password);
decrypt(password,1);
printf("Decrypted value = %s\n",password);
return 0;
}
The second person will enter the ciphertext and using the key “1”, he will be able to decrypt it easily and it will show the exact plaintext that the sender encrypted.
This is one of the oldest and simplest encryption techniques. If the key is found out by “a man in the middle”, it can be easily cracked. Because of this, this encryption technique is not used nowadays. But still, it was a fun thing to do and looks cool sharing with friends
Try the above simple code. If there is anything wrong, please comment.