Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

Assignment 2 Problems – String conversion: Implement a function which converts an input string to a set of blocks for cryptographic computation

Computer Science Nov 02, 2022

Assignment 2

Problems – String conversion:

Implement a function which converts an input string to a set of blocks for cryptographic computation. Specifically, the function should take an input a string and a block size and output a list (or an array) of converted string.

Pre/post conditions for the function is as follows:

• encode (P, N) - Pre-condition: The function takes a string ??, e.g., P=`hello world` and a block size N, e.g., N=8 (8 bit).

 - Intermediate process: It first convert the string into ASCII codes, e.g., P=104 101 108 108 111 32 119 111 114 108 100, then split it by the other input N –

Post-condition: It outputs a list of number blocks, e.g., PL=[104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100].

• decode (PL, N) - It recovers the original string Since 8-bit can express 0-255, the function does not need to split the values.

It just converts each character and puts into a list. However, if N is greater than 8, you should find a rule to avoid information lost.

The implementation must include Good test codes to demonstrate the correctness of your program.

 

 

 

 

 

 

 

 

 

 

 

 

Give some DETAIL on the algorithms and code that you are implementing. 

Include the OUTPUT or list the name of the output file you are submitting.

Archived Solution
Unlocked Solution

You have full access to this solution. To save a copy with all formatting and attachments, use the button below.

Already a member? Sign In
Important Note: This solution is from our archive and has been purchased by others. Submitting it as-is may trigger plagiarism detection. Use it for reference only.

For ready-to-submit work, please order a fresh solution below.

Or get 100% fresh solution
Get Custom Quote
Secure Payment