Programming

Programming questions? Ask a programmer for answers ASAP

Ask a Computer Expert,
Get an Answer ASAP!

This answer was rated:

For the Crypto system, Reduced DES (R-DES) Protocol, write…

For the Crypto system, Reduced...
For the Crypto system, Reduced DES (R-DES) Protocol, write code in python, C#, C, C++, or Java to develop the following functions:- Key Scheduler - input is 12-bit string, output are three 4-bit round keys- R-DES - input x = stream of bytes, k = 12-bit key string, flag = ‘0’ for encryption and ‘1’ for decryption.Outline:Plaintext and Ciphertext block size = 8-bit stringsKeyspace: key = {12-bit strings b1,b2,b3,……..b10,b11,b12}.Key Scheduling algorithm will generate the following 4-bit strings for the three rounds of the system:K1= (b1,b2,b3,b4) XOR (b5,b6,b7,b8)K2=(b5,b6,b7,b8) XOR (b9,b10,b11,b12)K3=(b9,b10,b11,b12) XOR (b1,b2,b3,b4)Encryption AlgorithmInput: L0R0 where L0 and R0 are the two nibbles of the plain byte.For round 1=1:3 {Li = Ri-1; Ri=Ki XOR Ri-1 XOR Li-1}Output: R3L3Decryption Algorithm is the same as Encryption Algorithm but with reverse key rounds.
Show More
Show Less
Ask Your Own Programming Question
Customer reply replied 1 month ago
This is an example of how it should work if done by hand.
Answered in 44 minutes by:
3/21/2018
Ingo U
Ingo U, Software Engineer
Category: Programming
Satisfied Customers: 796
Experience: Over 25 years experience in software development. Expert in Microsoft .Net, C#, C++, VB, SQL
Verified

Hi, you stated Python at the top, but the assignment offers other languages as a choice -- would you accept a solution in C or C++ ?

Ask Your Own Programming Question

Well, I went ahead and created a C++ implementation for you; I hope that's acceptable. See the attached zip folder containing source file R-DES.cpp

Please let me know if you need anything else or have any questions.

-Ingo

Ask Your Own Programming Question
Customer reply replied 1 month ago
Could you explain this to me? I have been struggling with this topic and have been confused on what the output should be. It looks and works great though!
Customer reply replied 1 month ago
Also C++ is totally fine. I usually work with python which is why I had that set at first.

OK, no problem. I have to go to a meeting but will be back online later, probably 2-3 hours. In the meantime, if you can post specific questions, that might be helpful in guiding our discussion.

Ask Your Own Programming Question
Customer reply replied 1 month ago
Okay I will do that.
Questions:
1) What exactly does the "keyScheduler" function do for the program?
2) I understand that the encryption encrypts it into a block encryption (because it's a block crypto system) and then decryption just reverts the current block into the original string, but how is the text transferred into the block encryption? (Sorry it's been too long since I've worked with c++ and I want to make sure I completely understand).
3) Where is that string, of which I presume is Latin, from originally?Again thank you so much for what you have done!

OK, I'm back. So:

1) The "keyScheduler" function is the first one that the assignment asked for. I chose to implement the "12-bit input string" as the first parameter, an unsigned short which is a 16-bit number. The second parameter to the function is the array of 3 K values that the algorithm requires us to compute from the 12 input bits. The code literally implements the "Step 1" in your pdf that computes K1, K2 and K3 -- our implementation stores these in a 3-element array of bytes (a byte is "unsigned char" in C/C++). Because array index in C++ starts at 0, K1 (on paper) is our array element #0, i.e. K[0], and so on.

2) To demonstrate the code working, I chose to create 3 buffers (arrays) of length BUF_SIZE - one that will hold the original input to encrypt ("plainText"), another one to hold the encrypted block ("encrypted"), and a third one to store the decrypted output ("decrypted") - which at the end should match the original input ("plaintext"), of course.

The line that starts with

sprintf(plainText, "Lorem ipsum ....

is the one that places a readable piece of text into the plainText buffer. Once loaded with that series of bytes, we call

RDES(plainText, encrypted, BLK_SIZE, K, DIR_ENCRYPT);

which is the second function the assignment asked for. It says, in effect, "run the RDES algorithm on the input block of size BLK_SIZE, in the direction indicated, and place the resulting bytes in the output block provided"

3) The "Lorem ipsum... " string is just a very common chunk of text we use in situations like this where you just need a sample piece of text. Google it!

Hope that helps! Feel free to follow up with other questions.

Ingo

Ingo U
Ingo U, Software Engineer
Category: Programming
Satisfied Customers: 796
Experience: Over 25 years experience in software development. Expert in Microsoft .Net, C#, C++, VB, SQL
Verified
Ingo U and 87 other Programming Specialists are ready to help you
Ask your own question now
Customer reply replied 1 month ago
Thank you so much! This was perfect I see it all now and it makes a lot more sense!

Hi,

Glad I could be of help, thanks for accepting my answer!
And, an extra THANKS for the bonus!

To ask me a future question directly, bookmark and use this link:

http://www.justanswer.com/computer/expert-ingou/

When you post a new question, please also put "FOR INGO U ONLY" at the beginning of the question; it'll help catch my eye.
If someone else responds before I do, you can work with them, or ask them to notify me. Of course, I hope that I've earned your confidence and will get the opportunity to assist you again.

Regards,
Ingo

Ask Your Own Programming Question
Customer reply replied 1 month ago
I will be asking for you every time for sure! You were amazing to work with!

Thanks! In fact, as long as this question still shows up on your list, it's still "our conversation", so you can also post to this thread - sometimes customers get in touch with me for additional questions that way.

Ask Your Own Programming Question
Was this answer helpful?
Ask Ingo U Your Own Question
Ingo U
Ingo U
Ingo U, Software Engineer
Category: Programming
Satisfied Customers: 796
796 Satisfied Customers
Experience: Over 25 years experience in software development. Expert in Microsoft .Net, C#, C++, VB, SQL

Ingo U is online now

A new question is answered every 9 seconds

How JustAnswer works:

  • Ask an ExpertExperts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional AnswerVia email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction GuaranteeRate the answer you receive.

JustAnswer in the News:

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

What Customers are Saying:

My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed.

One Happy CustomerNew York

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help.

Mary C.Freshfield, Liverpool, UK

This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!

AlexLos Angeles, CA

Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.

GPHesperia, CA

I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.

JustinKernersville, NC

Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around.

EstherWoodstock, NY

Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know.

RobinElkton, Maryland

< Previous | Next >

Meet the Experts:

ATLPROG

ATLPROG

Computer Software Engineer

7,677 satisfied customers

MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML

LogicPro

LogicPro

Computer Software Engineer

7,131 satisfied customers

Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.

unvadim

unvadim

Computer Software Engineer

1,168 satisfied customers

Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.

lifesaver

lifesaver

Computer Software Engineer

950 satisfied customers

Several years of intensive programming and application development experience in various platforms.

ehabtutor

ehabtutor

Computer Software Engineer

936 satisfied customers

Bachelor of computer science, 5+ years experience in software development, software company owner

TheDoctor

TheDoctor

Software Engineer

893 satisfied customers

M.S. in Internet Information Systems

The-PC-Guy

The-PC-Guy

Software Engineer

800 satisfied customers

Extensive Knowledge in PHP, MYSQL, CSS & Javascript

< Previous | Next >

Related Programming Questions
How do I find my workbook online. I updated one sent to me
how do I find my workbook online. I updated one sent to me on email and it said it was saved but when I opened it again from the email, it was not updated. … read more
Michael Rademacher
Michael Rademacher
MBA
4 satisfied customers
I need to renew my domain name with you. Sorry I dont
I need to renew my domain name charleychopchop.com … read more
Fran
Fran
IT Consultant
Associate Degree
164 satisfied customers
I'm trying to write this python to test average and grade
Hi, I'm trying to write this python to test average and grade but I can calculate my average. … read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,131 satisfied customers
I cannot add a photo to an excel document from my Mac book
I cannot add a photo to an excel document from my Mac book air … read more
Kamil Anwar
Kamil Anwar
IT Consultant / Systems Engineer
Bachelor\u0027s Degree
459 satisfied customers
Pick ONE of the following: 1. Ten CodeLab exercises for
Pick ONE of the following:1. Ten CodeLab exercises for STRUCTURES2. Textbok p. 652, problem 3:Corporate Sales Data Write a program that uses a structure to store the following data on a company divisi… read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,131 satisfied customers
I have a program need corection. Phyton. Make it correct I
I have a program need corection JA: Is there a specific language you're coding in? Customer: phyton JA: What's your objective? How can we solve this for you? Customer: make it correct I am missing som… read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,131 satisfied customers
From the below Java code, extend it and create a few
From the below Java code, extend it and create a few derivative classes, i.e. a Router, a Switch, a Server, a PSU (Power Supply Unit) etc. Each of those new classes has to be declared as extending the… read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,131 satisfied customers
I am trying to see how to get rid of the last few charaters
I am trying to see how to get rid of the last few charaters upto and including the dash in the following 2141B-DNM-4 3157E-FC-14 3157E-FC-10/12 3157E-FC-7/8 2157E-FC-6 … read more
The-PC-Guy
The-PC-Guy
Software Engineer
Bachelor's Degree
800 satisfied customers
Is this wordpress support? I have one site on Blue Host and
I have one site on Blue Host and could not get support there, … read more
Jinsmn
Jinsmn
Systems Administrator
Diplom
1,260 satisfied customers
I have a very simple question about a calculation/formula
I have a very simple question about a calculation/formula that I am trying to set up in Excel 16. … read more
Richard
Richard
IT Manager
IT Manager, Consultant
3,395 satisfied customers
I can't get the bar at the top of the sheet to show content.
I can't get the bar at the top of the sheet to show content … read more
The-PC-Guy
The-PC-Guy
Software Engineer
Bachelor's Degree
800 satisfied customers
Trying to make a chess board. Trying to reduce the code and
trying to reduce the code and add a function, im using python … read more
Ingo U
Ingo U
Software Engineer
796 satisfied customers
How do I fill an avery form 8660 address labels from an
how do I fill an avery form 8660 address labels from an excel spread sheet … read more
Michael Rademacher
Michael Rademacher
MBA
4 satisfied customers
How can I change a column of text to numbers? Just reguar
Highlight the column and change and change the format to number. … read more
Jeevan DSouza
Jeevan DSouza
Professor
PhD
3 satisfied customers
I am trying to paste in the issue I am having with my sql
I am trying to paste in the issue I am having with my sql code but it will not send … read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,131 satisfied customers
I get an error message that it is trying to terminate in
I get an error message that it is trying to terminate in unusual way … read more
Aaron B
Aaron B
Computer Repair Technician
High School or GED
428 satisfied customers
Can you help me in one python program pls. I want to know
i want to know what is wrong in my program. its throwing syntax error … read more
George Sibiya
George Sibiya
PhD
242 satisfied customers
I have an advanced exam in Excel. I want somebody to do the
Hello, i have an advanced exam in Excel. I want somebody to do the exam, I will send the pdf copy of the exam by email. You will do the actual excel worksheet based on the directions on the exam paper… read more
The-PC-Guy
The-PC-Guy
Software Engineer
Bachelor's Degree
800 satisfied customers
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Show MoreShow Less

Ask Your Question

x