SlideShare a Scribd company logo
1 of 1
Download to read offline
Task 4 : The key is hardcoded in the provided source DES encryption/decryption programs.
Please change the source code files of the DES encryption/decryption programs, so that the key
would be entered through the command line as the 4th input argument.
SOURCE CODE FOR ENCODE: #include<iostream> #include<fstream> #include<sstream>
#include<string> using namespace std; #include"cryptopp/cryptlib.h" #include"cryptopp/hex.h"
#include"cryptopp/filters.h" #include"cryptopp/des.h" #include"cryptopp/modes.h" using
namespace CryptoPP; string des_encode(string & plain,byte key[]) { string cipher; try { //cout <<
"plain text: " << plain << endl; ECB_Mode<DES>::Encryption enc; enc.SetKey(key,
DES::DEFAULT_KEYLENGTH); StringSource(plain, true, new StreamTransformationFilter(enc,
new StringSink(cipher)));//add padding by StreamTransformationFilter } catch(const
CryptoPP::Exception& e) { cerr << e.what() << endl; exit(1); } return cipher; } int main(int argc, char
* argv[]) { ifstream file1; ofstream file2; byte
key[DES::DEFAULT_KEYLENGTH]={'1','2','3','4','a','b','c','d'}; //key is hardcoded if(argc!=3) {
cout<<"usage:des_encode infile outfile" << endl; } cout << " The input file name is " << argv [1] <<
endl; cout << " The output file name is " << argv [2] << endl; file1.open(argv[1]);
file2.open(argv[2]); //reading stringstream buffer; buffer << file1.rdbuf(); string plain(buffer.str());
//print key string encoded; encoded.clear(); StringSource(key, sizeof(key), true, new HexEncoder(
new StringSink(encoded))); cout << "key: " << encoded << endl; //encrypt string
cipher=des_encode(plain,key); file2<<cipher; cout<<"cipher text stored in:"<<argv[2]<<endl;
file1.close(); file2.close(); return 0; }
SOURCE CODE FOR DECODE: #include<iostream> #include<fstream> #include<sstream>
#include<string> using namespace std; #include"cryptopp/cryptlib.h" #include"cryptopp/hex.h"
#include"cryptopp/filters.h" #include"cryptopp/des.h" #include"cryptopp/modes.h" using
namespace CryptoPP; string des_decode(string & cipher,byte key[]) { string plain; //decryption try {
ECB_Mode< DES >::Decryption dec; dec.SetKey(key, DES::DEFAULT_KEYLENGTH);
StringSource s(cipher, true, new StreamTransformationFilter(dec, new StringSink(plain))); cout <<
"recovered text: " << plain<< endl; } catch(const CryptoPP::Exception& e) { cerr << e.what() <<
endl; exit(1); } return plain; } int main(int argc,char * argv[]) { ifstream file1; ofstream file2; byte
key[DES::DEFAULT_KEYLENGTH]={'1','2','3','4','a','b','c','d'}; //key is hardcoded; if(argc!=3) {
cout<<"usage:des_decode infile outfile" <<endl; } cout << " The input file name is " << argv [1] <<
endl; cout << " The output file name is " << argv [2] << endl; file1.open(argv[1]);
file2.open(argv[2]); //reading stringstream buffer; buffer << file1.rdbuf(); string cipher(buffer.str());
//print key string encoded; encoded.clear(); StringSource(key, sizeof(key), true, new HexEncoder(
new StringSink(encoded))); cout << "key: " << encoded << endl; //decryption; string
plain=des_decode(cipher,key); file2<<plain; cout<<"plain text stored in:"<<argv[2]<<endl;
file1.close(); file2.close(); return 0; }

More Related Content

Similar to Task 4 The key is hardcoded in the provided source DES enc.pdf

Eight simple rules to writing secure PHP programs
Eight simple rules to writing secure PHP programsEight simple rules to writing secure PHP programs
Eight simple rules to writing secure PHP programs
Aleksandr Yampolskiy
 
Develop an encryption and decryption algorithm Your program should a.pdf
Develop an encryption and decryption algorithm  Your program should a.pdfDevelop an encryption and decryption algorithm  Your program should a.pdf
Develop an encryption and decryption algorithm Your program should a.pdf
deepaksatrker
 
Directions# Caesar Cipher ImplementationYour task in this homew.pdf
Directions# Caesar Cipher ImplementationYour task in this homew.pdfDirections# Caesar Cipher ImplementationYour task in this homew.pdf
Directions# Caesar Cipher ImplementationYour task in this homew.pdf
txkev
 
Lab01Filesbuild.bat@echo offclsset DRIVE_LETTER=1.docx
Lab01Filesbuild.bat@echo offclsset DRIVE_LETTER=1.docxLab01Filesbuild.bat@echo offclsset DRIVE_LETTER=1.docx
Lab01Filesbuild.bat@echo offclsset DRIVE_LETTER=1.docx
DIPESH30
 
I need help with the last 2 methods only in Huffman.java file the me.pdf
I need help with the last 2 methods only in Huffman.java file the me.pdfI need help with the last 2 methods only in Huffman.java file the me.pdf
I need help with the last 2 methods only in Huffman.java file the me.pdf
aggarwalshoppe14
 
Tutorial s crypto api session keys
Tutorial   s crypto api session keysTutorial   s crypto api session keys
Tutorial s crypto api session keys
Dr. Edwin Hernandez
 
Secureerasurecodebasedcloudstoragesystemwithsecuredataforwarding
Secureerasurecodebasedcloudstoragesystemwithsecuredataforwarding Secureerasurecodebasedcloudstoragesystemwithsecuredataforwarding
Secureerasurecodebasedcloudstoragesystemwithsecuredataforwarding
kadalisrikanth
 

Similar to Task 4 The key is hardcoded in the provided source DES enc.pdf (20)

Computer Security Laboratory Manual .pdf
Computer Security Laboratory Manual .pdfComputer Security Laboratory Manual .pdf
Computer Security Laboratory Manual .pdf
 
Eight simple rules to writing secure PHP programs
Eight simple rules to writing secure PHP programsEight simple rules to writing secure PHP programs
Eight simple rules to writing secure PHP programs
 
How does cryptography work? by Jeroen Ooms
How does cryptography work?  by Jeroen OomsHow does cryptography work?  by Jeroen Ooms
How does cryptography work? by Jeroen Ooms
 
Python Cryptography & Security
Python Cryptography & SecurityPython Cryptography & Security
Python Cryptography & Security
 
Python build your security tools.pdf
Python build your security tools.pdfPython build your security tools.pdf
Python build your security tools.pdf
 
Information security programming in ruby
Information security programming in rubyInformation security programming in ruby
Information security programming in ruby
 
Implement symmetric key algorithms.pptx
Implement symmetric key algorithms.pptxImplement symmetric key algorithms.pptx
Implement symmetric key algorithms.pptx
 
Slide cipher based encryption
Slide cipher based encryptionSlide cipher based encryption
Slide cipher based encryption
 
Develop an encryption and decryption algorithm Your program should a.pdf
Develop an encryption and decryption algorithm  Your program should a.pdfDevelop an encryption and decryption algorithm  Your program should a.pdf
Develop an encryption and decryption algorithm Your program should a.pdf
 
Directions# Caesar Cipher ImplementationYour task in this homew.pdf
Directions# Caesar Cipher ImplementationYour task in this homew.pdfDirections# Caesar Cipher ImplementationYour task in this homew.pdf
Directions# Caesar Cipher ImplementationYour task in this homew.pdf
 
Lab01Filesbuild.bat@echo offclsset DRIVE_LETTER=1.docx
Lab01Filesbuild.bat@echo offclsset DRIVE_LETTER=1.docxLab01Filesbuild.bat@echo offclsset DRIVE_LETTER=1.docx
Lab01Filesbuild.bat@echo offclsset DRIVE_LETTER=1.docx
 
I need help with the last 2 methods only in Huffman.java file the me.pdf
I need help with the last 2 methods only in Huffman.java file the me.pdfI need help with the last 2 methods only in Huffman.java file the me.pdf
I need help with the last 2 methods only in Huffman.java file the me.pdf
 
Unit-III_3R-CRYPTO_2021-22_VSM.pptx
Unit-III_3R-CRYPTO_2021-22_VSM.pptxUnit-III_3R-CRYPTO_2021-22_VSM.pptx
Unit-III_3R-CRYPTO_2021-22_VSM.pptx
 
Redis for your boss
Redis for your bossRedis for your boss
Redis for your boss
 
Tutorial s crypto api session keys
Tutorial   s crypto api session keysTutorial   s crypto api session keys
Tutorial s crypto api session keys
 
Serialization in Go
Serialization in GoSerialization in Go
Serialization in Go
 
Password (in)security
Password (in)securityPassword (in)security
Password (in)security
 
Secureerasurecodebasedcloudstoragesystemwithsecuredataforwarding
Secureerasurecodebasedcloudstoragesystemwithsecuredataforwarding Secureerasurecodebasedcloudstoragesystemwithsecuredataforwarding
Secureerasurecodebasedcloudstoragesystemwithsecuredataforwarding
 
Usp
UspUsp
Usp
 
Django cryptography
Django cryptographyDjango cryptography
Django cryptography
 

More from abcfootcare

Estudio de caso 52 Transparencia Fiscal Qu es justo La.pdf
Estudio de caso 52  Transparencia Fiscal  Qu es justo La.pdfEstudio de caso 52  Transparencia Fiscal  Qu es justo La.pdf
Estudio de caso 52 Transparencia Fiscal Qu es justo La.pdf
abcfootcare
 
In java and based upon a txt file please add the first FOUR.pdf
In java and based upon a txt file please add the first FOUR.pdfIn java and based upon a txt file please add the first FOUR.pdf
In java and based upon a txt file please add the first FOUR.pdf
abcfootcare
 

More from abcfootcare (20)

Monroe Manufacturing has a quick ratio of 200x 28125 in .pdf
Monroe Manufacturing has a quick ratio of 200x 28125 in .pdfMonroe Manufacturing has a quick ratio of 200x 28125 in .pdf
Monroe Manufacturing has a quick ratio of 200x 28125 in .pdf
 
Libertarian paternalism is defined as aGroup of answer cho.pdf
Libertarian paternalism is defined as aGroup of answer cho.pdfLibertarian paternalism is defined as aGroup of answer cho.pdf
Libertarian paternalism is defined as aGroup of answer cho.pdf
 
La utilidad neta para el ao en curso fue de 30000 Los si.pdf
La utilidad neta para el ao en curso fue de 30000 Los si.pdfLa utilidad neta para el ao en curso fue de 30000 Los si.pdf
La utilidad neta para el ao en curso fue de 30000 Los si.pdf
 
La cuenta Cash Over y Short a No es necesario en un siste.pdf
La cuenta Cash Over y Short  a No es necesario en un siste.pdfLa cuenta Cash Over y Short  a No es necesario en un siste.pdf
La cuenta Cash Over y Short a No es necesario en un siste.pdf
 
Los profesores Michael Halbert y Dwight Scott predicen que l.pdf
Los profesores Michael Halbert y Dwight Scott predicen que l.pdfLos profesores Michael Halbert y Dwight Scott predicen que l.pdf
Los profesores Michael Halbert y Dwight Scott predicen que l.pdf
 
Ltfen 1994 Meksika Pesosu Krizini aklaynz zellikle lt.pdf
Ltfen 1994 Meksika Pesosu Krizini aklaynz  zellikle lt.pdfLtfen 1994 Meksika Pesosu Krizini aklaynz  zellikle lt.pdf
Ltfen 1994 Meksika Pesosu Krizini aklaynz zellikle lt.pdf
 
Firmalarn ve finansal kurumlarn bir faiz oran takasna katlma.pdf
Firmalarn ve finansal kurumlarn bir faiz oran takasna katlma.pdfFirmalarn ve finansal kurumlarn bir faiz oran takasna katlma.pdf
Firmalarn ve finansal kurumlarn bir faiz oran takasna katlma.pdf
 
Estudio de caso 52 Transparencia Fiscal Qu es justo La.pdf
Estudio de caso 52  Transparencia Fiscal  Qu es justo La.pdfEstudio de caso 52  Transparencia Fiscal  Qu es justo La.pdf
Estudio de caso 52 Transparencia Fiscal Qu es justo La.pdf
 
Is there a case study of a business that employed retained e.pdf
Is there a case study of a business that employed retained e.pdfIs there a case study of a business that employed retained e.pdf
Is there a case study of a business that employed retained e.pdf
 
Cul es el tipo de cognicin que es evidente en el nio en .pdf
Cul es el tipo de cognicin que es evidente en el nio en .pdfCul es el tipo de cognicin que es evidente en el nio en .pdf
Cul es el tipo de cognicin que es evidente en el nio en .pdf
 
Ha perdido la publicidad televisiva su poder Adopte una po.pdf
Ha perdido la publicidad televisiva su poder Adopte una po.pdfHa perdido la publicidad televisiva su poder Adopte una po.pdf
Ha perdido la publicidad televisiva su poder Adopte una po.pdf
 
If a firms sources of funds have been as listed in the foll.pdf
If a firms sources of funds have been as listed in the foll.pdfIf a firms sources of funds have been as listed in the foll.pdf
If a firms sources of funds have been as listed in the foll.pdf
 
In java and based upon a txt file please add the first FOUR.pdf
In java and based upon a txt file please add the first FOUR.pdfIn java and based upon a txt file please add the first FOUR.pdf
In java and based upon a txt file please add the first FOUR.pdf
 
En cul de las siguientes situaciones esperara que el dla.pdf
En cul de las siguientes situaciones esperara que el dla.pdfEn cul de las siguientes situaciones esperara que el dla.pdf
En cul de las siguientes situaciones esperara que el dla.pdf
 
En los Estados Unidos la formacin y el desarrollo tienden .pdf
En los Estados Unidos la formacin y el desarrollo tienden .pdfEn los Estados Unidos la formacin y el desarrollo tienden .pdf
En los Estados Unidos la formacin y el desarrollo tienden .pdf
 
evaluate the importance of stakeholders especially in LoLC i.pdf
evaluate the importance of stakeholders especially in LoLC i.pdfevaluate the importance of stakeholders especially in LoLC i.pdf
evaluate the importance of stakeholders especially in LoLC i.pdf
 
Tim tiene preferencias racionales A y Jim tiene preferencia.pdf
Tim tiene preferencias racionales A y Jim tiene preferencia.pdfTim tiene preferencias racionales A y Jim tiene preferencia.pdf
Tim tiene preferencias racionales A y Jim tiene preferencia.pdf
 
E183 Restricciones y designaciones de activos Un hospital.pdf
E183 Restricciones y designaciones de activos Un hospital.pdfE183 Restricciones y designaciones de activos Un hospital.pdf
E183 Restricciones y designaciones de activos Un hospital.pdf
 
Ecuacin de efectivo Blitz Corp tiene un valor en libros d.pdf
Ecuacin de efectivo Blitz Corp tiene un valor en libros d.pdfEcuacin de efectivo Blitz Corp tiene un valor en libros d.pdf
Ecuacin de efectivo Blitz Corp tiene un valor en libros d.pdf
 
Compare and contrast neurotransmitter receptor proteins with.pdf
Compare and contrast neurotransmitter receptor proteins with.pdfCompare and contrast neurotransmitter receptor proteins with.pdf
Compare and contrast neurotransmitter receptor proteins with.pdf
 

Recently uploaded

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
httgc7rh9c
 

Recently uploaded (20)

Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptx
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdf
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptx
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use Cases
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 

Task 4 The key is hardcoded in the provided source DES enc.pdf

  • 1. Task 4 : The key is hardcoded in the provided source DES encryption/decryption programs. Please change the source code files of the DES encryption/decryption programs, so that the key would be entered through the command line as the 4th input argument. SOURCE CODE FOR ENCODE: #include<iostream> #include<fstream> #include<sstream> #include<string> using namespace std; #include"cryptopp/cryptlib.h" #include"cryptopp/hex.h" #include"cryptopp/filters.h" #include"cryptopp/des.h" #include"cryptopp/modes.h" using namespace CryptoPP; string des_encode(string & plain,byte key[]) { string cipher; try { //cout << "plain text: " << plain << endl; ECB_Mode<DES>::Encryption enc; enc.SetKey(key, DES::DEFAULT_KEYLENGTH); StringSource(plain, true, new StreamTransformationFilter(enc, new StringSink(cipher)));//add padding by StreamTransformationFilter } catch(const CryptoPP::Exception& e) { cerr << e.what() << endl; exit(1); } return cipher; } int main(int argc, char * argv[]) { ifstream file1; ofstream file2; byte key[DES::DEFAULT_KEYLENGTH]={'1','2','3','4','a','b','c','d'}; //key is hardcoded if(argc!=3) { cout<<"usage:des_encode infile outfile" << endl; } cout << " The input file name is " << argv [1] << endl; cout << " The output file name is " << argv [2] << endl; file1.open(argv[1]); file2.open(argv[2]); //reading stringstream buffer; buffer << file1.rdbuf(); string plain(buffer.str()); //print key string encoded; encoded.clear(); StringSource(key, sizeof(key), true, new HexEncoder( new StringSink(encoded))); cout << "key: " << encoded << endl; //encrypt string cipher=des_encode(plain,key); file2<<cipher; cout<<"cipher text stored in:"<<argv[2]<<endl; file1.close(); file2.close(); return 0; } SOURCE CODE FOR DECODE: #include<iostream> #include<fstream> #include<sstream> #include<string> using namespace std; #include"cryptopp/cryptlib.h" #include"cryptopp/hex.h" #include"cryptopp/filters.h" #include"cryptopp/des.h" #include"cryptopp/modes.h" using namespace CryptoPP; string des_decode(string & cipher,byte key[]) { string plain; //decryption try { ECB_Mode< DES >::Decryption dec; dec.SetKey(key, DES::DEFAULT_KEYLENGTH); StringSource s(cipher, true, new StreamTransformationFilter(dec, new StringSink(plain))); cout << "recovered text: " << plain<< endl; } catch(const CryptoPP::Exception& e) { cerr << e.what() << endl; exit(1); } return plain; } int main(int argc,char * argv[]) { ifstream file1; ofstream file2; byte key[DES::DEFAULT_KEYLENGTH]={'1','2','3','4','a','b','c','d'}; //key is hardcoded; if(argc!=3) { cout<<"usage:des_decode infile outfile" <<endl; } cout << " The input file name is " << argv [1] << endl; cout << " The output file name is " << argv [2] << endl; file1.open(argv[1]); file2.open(argv[2]); //reading stringstream buffer; buffer << file1.rdbuf(); string cipher(buffer.str()); //print key string encoded; encoded.clear(); StringSource(key, sizeof(key), true, new HexEncoder( new StringSink(encoded))); cout << "key: " << encoded << endl; //decryption; string plain=des_decode(cipher,key); file2<<plain; cout<<"plain text stored in:"<<argv[2]<<endl; file1.close(); file2.close(); return 0; }