Feistel Cipher

  • Uploaded by: Pranav Doshi
  • 0
  • 0
  • January 2021
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Feistel Cipher as PDF for free.

More details

  • Words: 161
  • Pages: 2
Loading documents preview...
FEISTEL CIPHER import java.io.*; import java.util.*; class feistel { public static void main(String args[]) throws Exception { int a[]=new int[20]; int left[]=new int[10]; int right[]=new int[10]; int key[]=new int[10]; int temp[]=new int[10]; int m[]=new int[10]; int i,k; Scanner sc=new Scanner(System.in); BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter length of string:"); int n=Integer.parseInt(br.readLine()); System.out.println("Enter plaintext:"); for(i=0;i
for(i=0;i<(n/2);i++) left[i]=right[i]; for(i=0;i<(n/2);i++) right[i]=m[i]; System.out.println(); System.out.println("Round " + (k+1)); System.out.print("Left:"); for(i=0;i<(n/2);i++) System.out.print(left[i]); System.out.println(); System.out.print("Right:"); for(i=0;i<(n/2);i++) System.out.print(right[i]); } System.out.println(); System.out.println("Encrypted string is:"); for(i=0;i<(n/2);i++) { System.out.print(left[i]); } System.out.print(" "); for(i=0;i<(n/2);i++) System.out.print(right[i]); } } /*OUTPUT: C:\ins>java feistel Enter length of string: 8 Enter plaintext: 01010101 Enter key: 1010 Left string: 0101 Right string: 0101 Round 1 Left:0101 Right:1010 Round 2 Left:1010 Right:0101 Round 3 Left:0101 Right:0101 Round 4 Left:0101 Right:1010 Encrypted string is: 0101 1010 */

Related Documents


More Documents from "Dgray93lon"

Feistel Cipher
January 2021 1
Final Engineering.pdf
January 2021 1
Solubility
January 2021 1
Artificial Intelligence
January 2021 0