Showing posts from August, 2014

Mono-alphabetic Cipher Implementation - C Tutorial

A mono-alphabetic cipher is a type of simple substitution cipher. In this cipher technique each letter of the plaintext is replaced by another letter in the cipher-text. An example of a mono-alphabetic cipher key follows:   Plain Text   >>>   a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z Cipher Text >>>  z  w  x  y  o  p  r  q  a  h  c  b  e  s  u  t  v  f  g  j  l  k  m  n  d  i   This key means that any ‘a’ in the plaintext will be replaced by a ‘z’ in the cipher-text, any ‘z’ in the plaintext will be replaced by a ‘i’ in the cipher-text, and so on. The following program shows the simple implementation of mono-alphabetic cipher technique in c language for encrypting and decrypting file   [crayon ] #include <stdio.h> #include <string.h> #define FILE_NAME_MAX 30 extern char alpha[26][2]={ {‘a’,’z’},{‘b’,’w’},{‘c’,’x’},{‘d’,’y’},{‘e’,’o’} ,{‘f’,’p’},{‘g’,’r’},{‘h’,’q’},{‘i’,’a’},{‘j’,’h’}, {‘k’,’c’},{‘l’,’b’},{‘m’,’e’},{‘n’,’s

Prime number program code in Scilab

x=input("Enter any number ");flag=0;for i = 2:(x-1) if(modulo(x,i)==0) then flag=1; break; end;endif(flag==1) then disp("not prime number");else disp("prime number");end;

Code for checking Palindrome string in Scilab

x=input("Enter a string ",["string"]);y=strrev(x);if (x==y) thendisp("Palindrome string");else disp("Not palindrome string");end;

Changing routing table entries on windows operating system

To change the routing table entries on windows operating system we need to use “route” command. In windows operating system, “route” is a command-line utility used to view and manipulate the TCP/IP routing tables. Manual manipulation of the routing table is characteristic of static routing i.e., if we are manipulating routing tables using “route” command then we are doing static routing not dynamic routing. To see details about “route” command simply type “route” on cmd as shown below: C:\Users\Dell>route This will display following information: ROUTE [-f] [-p] [-4|-6] command [destination] [MASK netmask] [gateway] [METRIC metric] [IF interface] -f Clears the routing tables of all gateway entries. If this is used in conjunction with one of the commands, the tables are cleared prior to running the command. -p When used with the ADD command, makes a route persistent across boots of the system. By default, routes are not preserved when the system is restarted. Igno