SlideShare a Scribd company logo
1 of 3
Download to read offline
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
public class CbcVigenere {
public static void main(String[] args) throws IOException {
File f= new File(args[0]);
BufferedReader bufferedReader = new BufferedReader(new FileReader(f));
StringBuffer stringBuffer = new StringBuffer();
String line;
while((line =bufferedReader.readLine())!=null){
stringBuffer.append(line).append(" ");
}
String input = stringBuffer.toString();
String extract = input.replaceAll("[^a-zA-Z]+", "").toLowerCase();
int k = extract.length();
String plaintxt = extract.replaceAll("(.{80})","$1 ");
System.out.println("Plaintext file name: " + args[0]);
System.out.println("Vigenere keyword: " + args[1]);
System.out.println("Initialization vector: " + args[2]+ " ");
System.out.println("Clean Plaintext:  " + plaintxt + " ");
int pad=0;
do {
extract= extract + "x";
pad++;
}while(extract.length() % args[1].length() != 0);
int j=0;
String fullcipher= "";
for( int i=0;i<(extract.length()/ args[1].length());i++){
String ciphertxt = encrypt(extract, args[1], args[2], j );
j=j + args[1].length();
args[2] = ciphertxt;
fullcipher = fullcipher + ciphertxt;
}
//System.out.println(plaintxt.length()/args[1].length());
System.out.println("Ciphertext:  " + fullcipher.replaceAll("(.{80})","$1 "));
System.out.println(" Number of characters in clean plaintext file: " + k);
System.out.println("Block size = " + args[1].length());
System.out.println("Number is pad characters added: " + pad);
}
public static String encrypt(String txt, String key, String IV, int pos){
String ab ="";
String cd ="";
for(int i=0; i
Solution
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
public class CbcVigenere {
public static void main(String[] args) throws IOException {
File f= new File(args[0]);
BufferedReader bufferedReader = new BufferedReader(new FileReader(f));
StringBuffer stringBuffer = new StringBuffer();
String line;
while((line =bufferedReader.readLine())!=null){
stringBuffer.append(line).append(" ");
}
String input = stringBuffer.toString();
String extract = input.replaceAll("[^a-zA-Z]+", "").toLowerCase();
int k = extract.length();
String plaintxt = extract.replaceAll("(.{80})","$1 ");
System.out.println("Plaintext file name: " + args[0]);
System.out.println("Vigenere keyword: " + args[1]);
System.out.println("Initialization vector: " + args[2]+ " ");
System.out.println("Clean Plaintext:  " + plaintxt + " ");
int pad=0;
do {
extract= extract + "x";
pad++;
}while(extract.length() % args[1].length() != 0);
int j=0;
String fullcipher= "";
for( int i=0;i<(extract.length()/ args[1].length());i++){
String ciphertxt = encrypt(extract, args[1], args[2], j );
j=j + args[1].length();
args[2] = ciphertxt;
fullcipher = fullcipher + ciphertxt;
}
//System.out.println(plaintxt.length()/args[1].length());
System.out.println("Ciphertext:  " + fullcipher.replaceAll("(.{80})","$1 "));
System.out.println(" Number of characters in clean plaintext file: " + k);
System.out.println("Block size = " + args[1].length());
System.out.println("Number is pad characters added: " + pad);
}
public static String encrypt(String txt, String key, String IV, int pos){
String ab ="";
String cd ="";
for(int i=0; i

More Related Content

Similar to import java.io.BufferedReader; import java.io.File; import java..pdf

import java.io.BufferedReader; import java.io.IOException; impor.pdf
import java.io.BufferedReader; import java.io.IOException; impor.pdfimport java.io.BufferedReader; import java.io.IOException; impor.pdf
import java.io.BufferedReader; import java.io.IOException; impor.pdfaravlitraders2012
 
Please help me with a UML class diagram for the following code im.pdf
Please help me with a UML class diagram for the following code im.pdfPlease help me with a UML class diagram for the following code im.pdf
Please help me with a UML class diagram for the following code im.pdfaioils
 
A topology of memory leaks on the JVM
A topology of memory leaks on the JVMA topology of memory leaks on the JVM
A topology of memory leaks on the JVMRafael Winterhalter
 
Create a text file named lnfo.txt. Enter the following informatio.pdf
Create a text file named lnfo.txt. Enter the following informatio.pdfCreate a text file named lnfo.txt. Enter the following informatio.pdf
Create a text file named lnfo.txt. Enter the following informatio.pdfshahidqamar17
 
Java programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarJava programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarROHIT JAISWAR
 
Write a program that will count the number of characters- words- and l.docx
Write a program that will count the number of characters- words- and l.docxWrite a program that will count the number of characters- words- and l.docx
Write a program that will count the number of characters- words- and l.docxlez31palka
 
Java IO Streams V4
Java IO Streams V4Java IO Streams V4
Java IO Streams V4Sunil OS
 
DisplayBook.java import java.io.File; import java.io.FileInput.pdf
DisplayBook.java import java.io.File; import java.io.FileInput.pdfDisplayBook.java import java.io.File; import java.io.FileInput.pdf
DisplayBook.java import java.io.File; import java.io.FileInput.pdfsudheerforce
 
Chapter 12 - File Input and Output
Chapter 12 - File Input and OutputChapter 12 - File Input and Output
Chapter 12 - File Input and OutputEduardo Bergavera
 
Java căn bản - Chapter12
Java căn bản - Chapter12Java căn bản - Chapter12
Java căn bản - Chapter12Vince Vo
 
• GUI design using drag and drop feature of IDE(Net beans), • File IO
•	GUI design using drag and drop feature of IDE(Net beans), •	File IO•	GUI design using drag and drop feature of IDE(Net beans), •	File IO
• GUI design using drag and drop feature of IDE(Net beans), • File IOSyedShahroseSohail
 
Object oriented programming la bmanual jntu
Object oriented programming la bmanual jntuObject oriented programming la bmanual jntu
Object oriented programming la bmanual jntuKhurshid Asghar
 
The Java Program for the above given isimport java.io.File;impo.pdf
The Java Program for the above given isimport java.io.File;impo.pdfThe Java Program for the above given isimport java.io.File;impo.pdf
The Java Program for the above given isimport java.io.File;impo.pdfanjanacottonmills
 

Similar to import java.io.BufferedReader; import java.io.File; import java..pdf (20)

Inheritance
InheritanceInheritance
Inheritance
 
import java.io.BufferedReader; import java.io.IOException; impor.pdf
import java.io.BufferedReader; import java.io.IOException; impor.pdfimport java.io.BufferedReader; import java.io.IOException; impor.pdf
import java.io.BufferedReader; import java.io.IOException; impor.pdf
 
Java Programming - 06 java file io
Java Programming - 06 java file ioJava Programming - 06 java file io
Java Programming - 06 java file io
 
Lab4
Lab4Lab4
Lab4
 
CORE JAVA-1
CORE JAVA-1CORE JAVA-1
CORE JAVA-1
 
Please help me with a UML class diagram for the following code im.pdf
Please help me with a UML class diagram for the following code im.pdfPlease help me with a UML class diagram for the following code im.pdf
Please help me with a UML class diagram for the following code im.pdf
 
Java I/o streams
Java I/o streamsJava I/o streams
Java I/o streams
 
A topology of memory leaks on the JVM
A topology of memory leaks on the JVMA topology of memory leaks on the JVM
A topology of memory leaks on the JVM
 
Create a text file named lnfo.txt. Enter the following informatio.pdf
Create a text file named lnfo.txt. Enter the following informatio.pdfCreate a text file named lnfo.txt. Enter the following informatio.pdf
Create a text file named lnfo.txt. Enter the following informatio.pdf
 
Java programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarJava programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswar
 
Studyx5
Studyx5Studyx5
Studyx5
 
Write a program that will count the number of characters- words- and l.docx
Write a program that will count the number of characters- words- and l.docxWrite a program that will count the number of characters- words- and l.docx
Write a program that will count the number of characters- words- and l.docx
 
Java IO Streams V4
Java IO Streams V4Java IO Streams V4
Java IO Streams V4
 
Java Day-6
Java Day-6Java Day-6
Java Day-6
 
DisplayBook.java import java.io.File; import java.io.FileInput.pdf
DisplayBook.java import java.io.File; import java.io.FileInput.pdfDisplayBook.java import java.io.File; import java.io.FileInput.pdf
DisplayBook.java import java.io.File; import java.io.FileInput.pdf
 
Chapter 12 - File Input and Output
Chapter 12 - File Input and OutputChapter 12 - File Input and Output
Chapter 12 - File Input and Output
 
Java căn bản - Chapter12
Java căn bản - Chapter12Java căn bản - Chapter12
Java căn bản - Chapter12
 
• GUI design using drag and drop feature of IDE(Net beans), • File IO
•	GUI design using drag and drop feature of IDE(Net beans), •	File IO•	GUI design using drag and drop feature of IDE(Net beans), •	File IO
• GUI design using drag and drop feature of IDE(Net beans), • File IO
 
Object oriented programming la bmanual jntu
Object oriented programming la bmanual jntuObject oriented programming la bmanual jntu
Object oriented programming la bmanual jntu
 
The Java Program for the above given isimport java.io.File;impo.pdf
The Java Program for the above given isimport java.io.File;impo.pdfThe Java Program for the above given isimport java.io.File;impo.pdf
The Java Program for the above given isimport java.io.File;impo.pdf
 

More from aquacosmossystems

DnaAORC This protein is responsible for initiation of DNA replicat.pdf
DnaAORC This protein is responsible for initiation of DNA replicat.pdfDnaAORC This protein is responsible for initiation of DNA replicat.pdf
DnaAORC This protein is responsible for initiation of DNA replicat.pdfaquacosmossystems
 
Answer(19)Mary’s parents are normal, therefore her brother must.pdf
Answer(19)Mary’s parents are normal, therefore her brother must.pdfAnswer(19)Mary’s parents are normal, therefore her brother must.pdf
Answer(19)Mary’s parents are normal, therefore her brother must.pdfaquacosmossystems
 
Answer Q1. Red mangroove is the last mangroove to colonise on the.pdf
Answer Q1. Red mangroove is the last mangroove to colonise on the.pdfAnswer Q1. Red mangroove is the last mangroove to colonise on the.pdf
Answer Q1. Red mangroove is the last mangroove to colonise on the.pdfaquacosmossystems
 
An Arrhenius acid produces H+ ions insolutionA Bronsted-Lowry acid.pdf
An Arrhenius acid produces H+ ions insolutionA Bronsted-Lowry acid.pdfAn Arrhenius acid produces H+ ions insolutionA Bronsted-Lowry acid.pdf
An Arrhenius acid produces H+ ions insolutionA Bronsted-Lowry acid.pdfaquacosmossystems
 
Ans. One of the main disadvantage is chromatic aberrasion. A more li.pdf
Ans. One of the main disadvantage is chromatic aberrasion. A more li.pdfAns. One of the main disadvantage is chromatic aberrasion. A more li.pdf
Ans. One of the main disadvantage is chromatic aberrasion. A more li.pdfaquacosmossystems
 
A coordination problem occurs in situations where there is no Nash E.pdf
A coordination problem occurs in situations where there is no Nash E.pdfA coordination problem occurs in situations where there is no Nash E.pdf
A coordination problem occurs in situations where there is no Nash E.pdfaquacosmossystems
 
1. When an integrated F plasmid leaves the chromosome it may take so.pdf
1. When an integrated F plasmid leaves the chromosome it may take so.pdf1. When an integrated F plasmid leaves the chromosome it may take so.pdf
1. When an integrated F plasmid leaves the chromosome it may take so.pdfaquacosmossystems
 
1. A DNA molecule contains two strands of poly deoxyribonucleotide s.pdf
1. A DNA molecule contains two strands of poly deoxyribonucleotide s.pdf1. A DNA molecule contains two strands of poly deoxyribonucleotide s.pdf
1. A DNA molecule contains two strands of poly deoxyribonucleotide s.pdfaquacosmossystems
 
Ethyl 4-aminobenzoate is a basic organic compound. In basic and neut.pdf
  Ethyl 4-aminobenzoate is a basic organic compound. In basic and neut.pdf  Ethyl 4-aminobenzoate is a basic organic compound. In basic and neut.pdf
Ethyl 4-aminobenzoate is a basic organic compound. In basic and neut.pdfaquacosmossystems
 
draw a sphere and use raytracing on the sphere in OpenGL glut. .pdf
 draw a sphere and use raytracing on the sphere in OpenGL glut. .pdf draw a sphere and use raytracing on the sphere in OpenGL glut. .pdf
draw a sphere and use raytracing on the sphere in OpenGL glut. .pdfaquacosmossystems
 
SnO2 (ore) is initially washed and dressed. then .pdf
                     SnO2 (ore) is initially washed and dressed. then .pdf                     SnO2 (ore) is initially washed and dressed. then .pdf
SnO2 (ore) is initially washed and dressed. then .pdfaquacosmossystems
 
d) Valine Note its side chain doesnt contain a.pdf
                     d) Valine Note its side chain doesnt contain a.pdf                     d) Valine Note its side chain doesnt contain a.pdf
d) Valine Note its side chain doesnt contain a.pdfaquacosmossystems
 
Amphiprotic. The preferred term is amphoteric. A .pdf
                     Amphiprotic. The preferred term is amphoteric. A .pdf                     Amphiprotic. The preferred term is amphoteric. A .pdf
Amphiprotic. The preferred term is amphoteric. A .pdfaquacosmossystems
 
at equivalence point, Moles OH- added = moles H+.pdf
                     at equivalence point,  Moles OH- added = moles H+.pdf                     at equivalence point,  Moles OH- added = moles H+.pdf
at equivalence point, Moles OH- added = moles H+.pdfaquacosmossystems
 
We Know that     Water is a Polar component as .pdf
                     We Know that      Water is a Polar component as .pdf                     We Know that      Water is a Polar component as .pdf
We Know that     Water is a Polar component as .pdfaquacosmossystems
 
molar mass of C2H5OH = 46.1 gmole moles of C2H5O.pdf
                     molar mass of C2H5OH = 46.1 gmole moles of C2H5O.pdf                     molar mass of C2H5OH = 46.1 gmole moles of C2H5O.pdf
molar mass of C2H5OH = 46.1 gmole moles of C2H5O.pdfaquacosmossystems
 
What property of PN code makes them suitable for use in spread spect.pdf
What property of PN code makes them suitable for use in spread spect.pdfWhat property of PN code makes them suitable for use in spread spect.pdf
What property of PN code makes them suitable for use in spread spect.pdfaquacosmossystems
 
TLC can be used to help determine the number of components in a mixt.pdf
TLC can be used to help determine the number of components in a mixt.pdfTLC can be used to help determine the number of components in a mixt.pdf
TLC can be used to help determine the number of components in a mixt.pdfaquacosmossystems
 
There may have some variables affect the model. So the error term wi.pdf
There may have some variables affect the model. So the error term wi.pdfThere may have some variables affect the model. So the error term wi.pdf
There may have some variables affect the model. So the error term wi.pdfaquacosmossystems
 
There are four major functional characteristics of skeletal muscle..pdf
There are four major functional characteristics of skeletal muscle..pdfThere are four major functional characteristics of skeletal muscle..pdf
There are four major functional characteristics of skeletal muscle..pdfaquacosmossystems
 

More from aquacosmossystems (20)

DnaAORC This protein is responsible for initiation of DNA replicat.pdf
DnaAORC This protein is responsible for initiation of DNA replicat.pdfDnaAORC This protein is responsible for initiation of DNA replicat.pdf
DnaAORC This protein is responsible for initiation of DNA replicat.pdf
 
Answer(19)Mary’s parents are normal, therefore her brother must.pdf
Answer(19)Mary’s parents are normal, therefore her brother must.pdfAnswer(19)Mary’s parents are normal, therefore her brother must.pdf
Answer(19)Mary’s parents are normal, therefore her brother must.pdf
 
Answer Q1. Red mangroove is the last mangroove to colonise on the.pdf
Answer Q1. Red mangroove is the last mangroove to colonise on the.pdfAnswer Q1. Red mangroove is the last mangroove to colonise on the.pdf
Answer Q1. Red mangroove is the last mangroove to colonise on the.pdf
 
An Arrhenius acid produces H+ ions insolutionA Bronsted-Lowry acid.pdf
An Arrhenius acid produces H+ ions insolutionA Bronsted-Lowry acid.pdfAn Arrhenius acid produces H+ ions insolutionA Bronsted-Lowry acid.pdf
An Arrhenius acid produces H+ ions insolutionA Bronsted-Lowry acid.pdf
 
Ans. One of the main disadvantage is chromatic aberrasion. A more li.pdf
Ans. One of the main disadvantage is chromatic aberrasion. A more li.pdfAns. One of the main disadvantage is chromatic aberrasion. A more li.pdf
Ans. One of the main disadvantage is chromatic aberrasion. A more li.pdf
 
A coordination problem occurs in situations where there is no Nash E.pdf
A coordination problem occurs in situations where there is no Nash E.pdfA coordination problem occurs in situations where there is no Nash E.pdf
A coordination problem occurs in situations where there is no Nash E.pdf
 
1. When an integrated F plasmid leaves the chromosome it may take so.pdf
1. When an integrated F plasmid leaves the chromosome it may take so.pdf1. When an integrated F plasmid leaves the chromosome it may take so.pdf
1. When an integrated F plasmid leaves the chromosome it may take so.pdf
 
1. A DNA molecule contains two strands of poly deoxyribonucleotide s.pdf
1. A DNA molecule contains two strands of poly deoxyribonucleotide s.pdf1. A DNA molecule contains two strands of poly deoxyribonucleotide s.pdf
1. A DNA molecule contains two strands of poly deoxyribonucleotide s.pdf
 
Ethyl 4-aminobenzoate is a basic organic compound. In basic and neut.pdf
  Ethyl 4-aminobenzoate is a basic organic compound. In basic and neut.pdf  Ethyl 4-aminobenzoate is a basic organic compound. In basic and neut.pdf
Ethyl 4-aminobenzoate is a basic organic compound. In basic and neut.pdf
 
draw a sphere and use raytracing on the sphere in OpenGL glut. .pdf
 draw a sphere and use raytracing on the sphere in OpenGL glut. .pdf draw a sphere and use raytracing on the sphere in OpenGL glut. .pdf
draw a sphere and use raytracing on the sphere in OpenGL glut. .pdf
 
SnO2 (ore) is initially washed and dressed. then .pdf
                     SnO2 (ore) is initially washed and dressed. then .pdf                     SnO2 (ore) is initially washed and dressed. then .pdf
SnO2 (ore) is initially washed and dressed. then .pdf
 
d) Valine Note its side chain doesnt contain a.pdf
                     d) Valine Note its side chain doesnt contain a.pdf                     d) Valine Note its side chain doesnt contain a.pdf
d) Valine Note its side chain doesnt contain a.pdf
 
Amphiprotic. The preferred term is amphoteric. A .pdf
                     Amphiprotic. The preferred term is amphoteric. A .pdf                     Amphiprotic. The preferred term is amphoteric. A .pdf
Amphiprotic. The preferred term is amphoteric. A .pdf
 
at equivalence point, Moles OH- added = moles H+.pdf
                     at equivalence point,  Moles OH- added = moles H+.pdf                     at equivalence point,  Moles OH- added = moles H+.pdf
at equivalence point, Moles OH- added = moles H+.pdf
 
We Know that     Water is a Polar component as .pdf
                     We Know that      Water is a Polar component as .pdf                     We Know that      Water is a Polar component as .pdf
We Know that     Water is a Polar component as .pdf
 
molar mass of C2H5OH = 46.1 gmole moles of C2H5O.pdf
                     molar mass of C2H5OH = 46.1 gmole moles of C2H5O.pdf                     molar mass of C2H5OH = 46.1 gmole moles of C2H5O.pdf
molar mass of C2H5OH = 46.1 gmole moles of C2H5O.pdf
 
What property of PN code makes them suitable for use in spread spect.pdf
What property of PN code makes them suitable for use in spread spect.pdfWhat property of PN code makes them suitable for use in spread spect.pdf
What property of PN code makes them suitable for use in spread spect.pdf
 
TLC can be used to help determine the number of components in a mixt.pdf
TLC can be used to help determine the number of components in a mixt.pdfTLC can be used to help determine the number of components in a mixt.pdf
TLC can be used to help determine the number of components in a mixt.pdf
 
There may have some variables affect the model. So the error term wi.pdf
There may have some variables affect the model. So the error term wi.pdfThere may have some variables affect the model. So the error term wi.pdf
There may have some variables affect the model. So the error term wi.pdf
 
There are four major functional characteristics of skeletal muscle..pdf
There are four major functional characteristics of skeletal muscle..pdfThere are four major functional characteristics of skeletal muscle..pdf
There are four major functional characteristics of skeletal muscle..pdf
 

Recently uploaded

Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 

Recently uploaded (20)

Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 

import java.io.BufferedReader; import java.io.File; import java..pdf

  • 1. import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; public class CbcVigenere { public static void main(String[] args) throws IOException { File f= new File(args[0]); BufferedReader bufferedReader = new BufferedReader(new FileReader(f)); StringBuffer stringBuffer = new StringBuffer(); String line; while((line =bufferedReader.readLine())!=null){ stringBuffer.append(line).append(" "); } String input = stringBuffer.toString(); String extract = input.replaceAll("[^a-zA-Z]+", "").toLowerCase(); int k = extract.length(); String plaintxt = extract.replaceAll("(.{80})","$1 "); System.out.println("Plaintext file name: " + args[0]); System.out.println("Vigenere keyword: " + args[1]); System.out.println("Initialization vector: " + args[2]+ " "); System.out.println("Clean Plaintext: " + plaintxt + " "); int pad=0; do { extract= extract + "x"; pad++; }while(extract.length() % args[1].length() != 0); int j=0; String fullcipher= ""; for( int i=0;i<(extract.length()/ args[1].length());i++){ String ciphertxt = encrypt(extract, args[1], args[2], j ); j=j + args[1].length();
  • 2. args[2] = ciphertxt; fullcipher = fullcipher + ciphertxt; } //System.out.println(plaintxt.length()/args[1].length()); System.out.println("Ciphertext: " + fullcipher.replaceAll("(.{80})","$1 ")); System.out.println(" Number of characters in clean plaintext file: " + k); System.out.println("Block size = " + args[1].length()); System.out.println("Number is pad characters added: " + pad); } public static String encrypt(String txt, String key, String IV, int pos){ String ab =""; String cd =""; for(int i=0; i Solution import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; public class CbcVigenere { public static void main(String[] args) throws IOException { File f= new File(args[0]); BufferedReader bufferedReader = new BufferedReader(new FileReader(f)); StringBuffer stringBuffer = new StringBuffer(); String line; while((line =bufferedReader.readLine())!=null){ stringBuffer.append(line).append(" "); } String input = stringBuffer.toString(); String extract = input.replaceAll("[^a-zA-Z]+", "").toLowerCase(); int k = extract.length(); String plaintxt = extract.replaceAll("(.{80})","$1 ");
  • 3. System.out.println("Plaintext file name: " + args[0]); System.out.println("Vigenere keyword: " + args[1]); System.out.println("Initialization vector: " + args[2]+ " "); System.out.println("Clean Plaintext: " + plaintxt + " "); int pad=0; do { extract= extract + "x"; pad++; }while(extract.length() % args[1].length() != 0); int j=0; String fullcipher= ""; for( int i=0;i<(extract.length()/ args[1].length());i++){ String ciphertxt = encrypt(extract, args[1], args[2], j ); j=j + args[1].length(); args[2] = ciphertxt; fullcipher = fullcipher + ciphertxt; } //System.out.println(plaintxt.length()/args[1].length()); System.out.println("Ciphertext: " + fullcipher.replaceAll("(.{80})","$1 ")); System.out.println(" Number of characters in clean plaintext file: " + k); System.out.println("Block size = " + args[1].length()); System.out.println("Number is pad characters added: " + pad); } public static String encrypt(String txt, String key, String IV, int pos){ String ab =""; String cd =""; for(int i=0; i