Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Writing an Encryption Algorithm - Lab | ECE 201, Lab Reports of Electrical and Electronics Engineering

Material Type: Lab; Class: Lab for Lecture 001; Subject: Electrical & Computer Enginrg; University: George Mason University; Term: Unknown 1989;

Typology: Lab Reports

Pre 2010

Uploaded on 02/12/2009

koofers-user-bo9
koofers-user-bo9 🇺🇸

10 documents

1 / 1

Toggle sidebar

Related documents


Partial preview of the text

Download Writing an Encryption Algorithm - Lab | ECE 201 and more Lab Reports Electrical and Electronics Engineering in PDF only on Docsity! ECE201 Lab#8: Writing An Encryption Algorithm Part A: Write an Function M-File called Scramble.m that will: • receive in a string as its only input and call it Secret. • return an error if Secret is < 50 characters or if it is > 80 characters or if Secret isn’t a row vector. • convert the text of Secret to its ASCII numerical representation and call it SecretNums. • use the function randperm and the length of Secret to generate a random permutation sequence called CODE. Note: CODE, Secret, and SecretNums should all have the same length. • use CODE as an index inside of SecretNums to generate a new row vector of numbers called Encrypted. • return an output to the MATLAB Command window of Encrypted converted back to its character format. (This is your message now encrypted). • generate a row vector of zeros twice the length of CODE called MixedUp. • replace every odd element in MixedUp with each element in Encrypted (in sequence). • replace every even element in MixedUp with each element in CODE (in sequence). Note: Every other element in MixedUp should now alternate between the elements in Encrypted and the elements in CODE. • return MixedUp as its only output argument. Part B: Write an M-File Function called UnScramble.m that uses Secret as its input and will: • call the function Scramble to obtain its output MixedUp. • generate the variable CODE from every even element in MixedUp (in sequence). • generate the variable Encrypted from every odd element in MixedUp (in sequence). • generate the variable NoSecret by using CODE as its index and assigning that to each element in Encrypted (in sequence). • overwrite NoSecret with its character representation using the char function. • return NoSecret as its only output argument. Clear all variables from the MATLAB workspace. Inside the MATLAB Command window, enter in any message (as a string) that is between 50 and 80 characters in length. This message should be readable in English and should mean something. Assign the variable name Secret to this message. Document your activities and results in a typed report. Include your MATLAB code. 1
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved