• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Des1
 

Des1

on

  • 641 views

DES ALGORITHMS

DES ALGORITHMS

Statistics

Views

Total Views
641
Views on SlideShare
641
Embed Views
0

Actions

Likes
0
Downloads
4
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Des1 Des1 Document Transcript

    • (DES)Data Encryption Standard:A block cipher processes the plaintextinput in fixed-sized blocks and produces ablock of cipher text of equal size for eachplaintext blockThe plaintext is 64 bits in length and the key(k) is 56 bits in length (16 rounds ofprocessing (16 sub keys (k (left shift to k1)k1…..k16 are generated for each roundbased on left shift)The plaintext block is divided into twohalves, LE0 and RE0. The two halves of thedata pass through 16 rounds of processingand then combine to produce the ciphertext block.A substitution is performed on the left halfof the data. This is done by applying around function F(left circular shift shufflesthe input block) to the right half of the dataand then taking the exclusive-OR (XOR) of
    • the output of that function and the left halfof the data.Permutation is performed that consists ofthe interchange of the two halves of thedata.
    • Implemtation of simple DES AlgorithmProgram:import java.security.*; // Java SecurityPackages There are three security-related packages in java 1. JCA/JCE(Java Cryptography Architecture & JavaCryptography Extensions) 2. JSSE( JavaSecure-Sockets Extension). 3. JAAS( JavaAuthentication & Authorization Service)import javax.crypto.*; // Provides theclasses and interfaces for cryptographicoperations. Operation includeencryption, key generation and keyagreement, and Message AuthenticationCode (MAC) generation.public class PrivateExample
    • {public static void main(String[] args)throws Exception{if (args.length != 1){System.err.println("Usage:JavaPrivateExample text");System.exit(1);}byte[] plainText =args[0].getBytes("UTF8"); /* 8-bitUnicode Transformation Format */System.out.println("n start generatingDES key");KeyGenerator KeyGen =KeyGenerator.getInstance("DES");KeyGen.init(56);Key key= KeyGen.generateKey();
    • System.out.println("n finish generatingDES key");Cipher cipher=Cipher.getInstance("DES/ECB/PKCS5Padding");//electronic code book : publickey crypto standard 5System.out.println("n"+cipher.getProvider().getInfo());System.out.println("n start encryption ");cipher.init(Cipher.ENCRYPT_MODE,key);byte[] cipherText =cipher.doFinal(plainText);System.out.println("Finish Encryption");System.out.println(newString(cipherText,"UTF8"));System.out.println("n StartDecryption");cipher.init(Cipher.DECRYPT_MODE,key);
    • byte[] newPlainText =cipher.doFinal(cipherText);System.out.println("Final decryption");System.out.println(newString(newPlainText, "UTF8"));}}Output :