Posts

IMPLEMENTATION OF SHA-1 ALGORITHM using JAVA

Image
AIM: To   write a java program to calculate the message digest of a text using the SHA-1 algorithm ALGORITHM: Step 1: Input the plain text Step 2: Append padding bits Step 3: Append length Step 4:Initialize   buffer. Step 5: Process message in 512-bit (16word)blocks Step 6: Encrypted in hexa decimal format Step 7: Display the encrypted text. PROGRAM: importjava.security.*; public class SHA1 { public static void main(String[] a) { try { MessageDigest md = MessageDigest.getInstance("SHA1"); System.out.println("Message digest object info: "); System.out.println(" Algorithm = " +md.getAlgorithm()); System.out.println(" Provider = " +md.getProvider()); System.out.println(" ToString = " +md.toString());   String input = ""; md.update(input.getBytes()); byte[] output = md.digest(); System.out.println(); System.out.println("SHA1(\""+...

IMPLEMENTATION OF HILL CIPHER

Image
AIM:             To write a   C++ program   to implement Hill   Cipher. ALGORITHM: Step 1:   Enter the plain text. Step 2: Enter   the matrix, named key matrix   for encryption. The elements of the matrix will be randomly chosen and of modulo 26. Step 3: Plain text characters are multiplied by the encryption matrix. Step 4: Display the cipher text. Step 5: Find the inverse of the key matrix. Step 6: For decryption, multiply   the characters of cipher text by key matrix to get plaintext and display it. PROGRAM: #include<iostream> using namespace std; int check(int); int main(intargc,char **argv) { int l,i,j,temp1,k[3][3],p[3][1],c[3][1]; char ch; cout<<"\nThis cipher has a key of length 9"; cout<<"\nEnter the 9 character key"; for(i=0;i<3;i++) {          ...

IMPLEMENTATION OF PLAYFAIR CIPHER in C++

Image
AIM:             Towrite a   C++ program   to implement Play Fair Cipher. ALGORITHM: Step 1: Generate Key matrix.      (a)Take any random key of any length and form a 5 X 5 matrix.                 (b) Fill the rows of the matrix with the key characters and ignore repeating character.                 (c) Fill the remaining matrix with alphabets from A to Z (except those already occurred in     the key). Step 2: Encrypt the data using encryption rule and key matrix                   (a) To Encrypt the data take two characters at time from plain text file and encrypt it            using one of the following rules.             ...