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 3 months 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 3 months 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 3 months 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 3 months 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 3 months 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 3 months 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?

How JustAnswer works

step-image
Describe your issueThe assistant will guide you
step-image
Chat 1:1 with a programmerLicensed Experts are available 24/7
step-image
100% satisfaction guaranteeGet all the answers you need
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,175 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

848 satisfied customers

Extensive Knowledge in PHP, MYSQL, CSS & Javascript

< Previous | Next >

Related Programming Questions
I have a funny answer when using LOOKUP function. Could you
I have a funny answer when using LOOKUP function. Could you help? … read more
Richard
Richard
IT Manager
IT Manager, Consultant
3,462 satisfied customers
Requesting three new fields to be added to the form that will
Requesting three new fields to be added to the form that will be manually filled out, but will be visible when the workbook is emailed. The new fields are Associate Name, Hire Date, and Due Date.… read more
AAATom
AAATom
Software Engineer
Master\u0027s Degree
42 satisfied customers
Hi there, Please can you assist with the following query. I
Hi there, Please can you assist with the following query. I have searched for a working example and have come up short. I am now asking the experts. I have created a form, inserted toggle boxes and in… read more
Brandon M.
Brandon M.
System Administrator
Vocational, Technical or Trade Scho
2,143 satisfied customers
I have a formula in which I have 13 possible values for x,
I have a formula in which I have 13 possible values for x, that could result in a predetermined answer. For example the formula is =1/(1/$B3+1/$B4+1/$B5+1/$B6+1/$B7+1/$B8). The b3 through b8 are the w… read more
Zabo04
Zabo04
Master\u0027s Student
Master\u0027s Degree
7 satisfied customers
Need help developing a formula for the following commission
Need help developing a formula for the following commission structure. Commissions will have a maximum of 2% for projects with a profit margin of 12% or higher and a minimum of .5% for project with a … read more
Suryanto
Suryanto
Computer Engineer
Bachelor's Degree
535 satisfied customers
Have a WS that contains some data, I then receive additional
Have a WS that contains some data, I then receive additional data on an adhoc basis that I need to match with and add to the WS. The original WS is "VoucherList". This contains 2 unique columns of Dat… read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
Hi John, I was using Excel 2000 to create a workbook. Sheet
Hi John, I was using Excel 2000 to create a workbook. Sheet 1 is similar to the file that I sent to you. There is a range from 65 to 100 columns. Each column has a range from 20 cells to 80 cells. Eac… read more
J. Mar
J. Mar
IT Specialist
Master's Degree
341 satisfied customers
I want to transpose data in excel,into columns. The data below
I want to transpose data in excel,into columns. The data below is an example. I have used the @ to show which data needs transposing to the upper row starting with a lett P. Not the number of rows is … read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
I need to know how to collapse redundant information within
I need to know how to collapse redundant information within a column of a table without creating a pivot table or altering information throughout the rest of the table… read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
I am developing a macro that insets form data into a spreadsheet.
I am developing a macro that insets form data into a spreadsheet. I want the macro to keep adding to the next row/incrementing row. My macro keeps referencing the row I recorded and references the cel… read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
Im trying to create a formula that will pull a value from
I'm trying to create a formula that will pull a value from another page, based on a drop down menu… read more
ehabtutor
ehabtutor
Computer Software Engineer
Bachelor's Degree
936 satisfied customers
Conditional Concatenation based on dates. Im looking for
Conditional Concatenation based on dates. I'm looking for a qucik detailed response in an excel macro. I need to concatenate strings based on several different conditions in 2 date ranges. Can you hel… read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
Hi .I would like to know if Excel could perform the following
Hi .I would like to know if Excel could perform the following type of calculation. I would like to be able to round figures up to the nearest 5. For example if this was an amount in currency (e.g. ste… read more
Simit
Simit
Bachelor\u0027s Degree
2,001 satisfied customers
I need a simple formula but dont know how to write it,eg
I need a simple formula but don't know how to write it,eg amount (a) plus (b) minus (c) = sum. All I know is to add up some amounts with the Sum symbol. Your help would be greatly appreciated. Regards… read more
Jason Jones
Jason Jones
AAS Information Technology
6,327 satisfied customers
IN EXCEL I HAVE A FORMULA THAT PERFORMS A NUMBER OF FUNCTIONS
IN EXCEL I HAVE A FORMULA THAT PERFORMS A NUMBER OF FUNCTIONS SUCH AS ADDING, SUBRACTING, MULTIPLYING ETC. AT SOME POINT ONE VALUE IS SUBSTRACTED FROM ANOTHER AND THEN MULTIPLIED BY A FACTOR. WHAT I N… read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
I have a start date and an end date (e.g 12/01/2009 and 01/03/2009)
I have a start date and an end date (e.g 12/01/2009 and 01/03/2009) in a column. In another column I have the average daily temperatures for every day, back to 2005. I would like to write a a forumula… read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
Hello, I am trying to figure out how to get the following into
Hello, I am trying to figure out how to get the following into an excel formula. In Column A I have several different names listed, some of them are the same but with different values in columns b and… read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
I have an large excel spread sheet Cell a1 contains a number
I have an large excel spread sheet Cell a1 contains a number assocated with B1, B2, B3. Cell a2 and a3 are null. Cell a4 contains a number assocated with b4. Cell a5 contains a number associated with … read more
abhi_iitian
abhi_iitian
Bachelor's Degree
1,543 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