Prev: quiver3 function - Line width question
Next: Real Time Workshop - Loading Multiple Parameters from Workspace
From: jeremy meduna on 4 Mar 2010 09:59 Write a matlab function ciphertext=project7(plaintext, k) that encrypts > the plaintext using the Playfair cipher with k as the keyword. The > alphabet is the 26 capital letters omitting Q to create the 5x5 matrix > > ex run: > > plain='HIDETHEGOLDINTHETREESTUMP'; > key='PLAYFAIREXAMPLE'; > project7(plain,key) > > ans= > > BMNDZBXDKYBEJVDMUIXMMNUVIF > > I have the 5X5 table figured out, I just do not know how to do the > function? Here is what I have so far... a=input('enter code key word as a string: '); b=['A':'Z']; b=='Q'; b(b=='Q')=[]; c=[a b]; [b m n]=unique(c,'first'); d=c(sort(m)); e=reshape(d,5,5); k=e'
From: Bruce Bowler on 4 Mar 2010 10:23 On Thu, 04 Mar 2010 14:59:09 +0000, jeremy meduna wrote: > Write a matlab function ciphertext=project7(plaintext, k) that encrypts >> the plaintext using the Playfair cipher with k as the keyword. The >> alphabet is the 26 capital letters omitting Q to create the 5x5 matrix >> >> ex run: >> >> plain='HIDETHEGOLDINTHETREESTUMP'; >> key='PLAYFAIREXAMPLE'; >> project7(plain,key) >> >> ans= >> >> BMNDZBXDKYBEJVDMUIXMMNUVIF >> >> I have the 5X5 table figured out, I just do not know how to do the >> function? > Here is what I have so far... > > a=input('enter code key word as a string: '); b=['A':'Z']; > b=='Q'; > b(b=='Q')=[]; > c=[a b]; > [b m n]=unique(c,'first'); > d=c(sort(m)); > e=reshape(d,5,5); > k=e' Have you tried any of the following... 1) talk to your classmates? 2) talk to your professor? 3) google? (I did, the first item that comes up looks *JUST* like your problem and partial solution and is dated 5 months ago)
From: jeremy meduna on 4 Mar 2010 12:19 Bruce Bowler <bbowler(a)bigelow.org> wrote in message <7va1k4FhiU1(a)mid.individual.net>... > On Thu, 04 Mar 2010 14:59:09 +0000, jeremy meduna wrote: > > > Write a matlab function ciphertext=project7(plaintext, k) that encrypts > >> the plaintext using the Playfair cipher with k as the keyword. The > >> alphabet is the 26 capital letters omitting Q to create the 5x5 matrix > >> > >> ex run: > >> > >> plain='HIDETHEGOLDINTHETREESTUMP'; > >> key='PLAYFAIREXAMPLE'; > >> project7(plain,key) > >> > >> ans= > >> > >> BMNDZBXDKYBEJVDMUIXMMNUVIF > >> > >> I have the 5X5 table figured out, I just do not know how to do the > >> function? > > Here is what I have so far... > > > > a=input('enter code key word as a string: '); b=['A':'Z']; > > b=='Q'; > > b(b=='Q')=[]; > > c=[a b]; > > [b m n]=unique(c,'first'); > > d=c(sort(m)); > > e=reshape(d,5,5); > > k=e' > > Have you tried any of the following... > > 1) talk to your classmates? > 2) talk to your professor? > 3) google? (I did, the first item that comes up looks *JUST* like your > problem and partial solution and is dated 5 months ago) I have tried all of the following to include spending countless hours in the lab trying to figure it out.....So please, if you are not going to help stop replying to my posts. Thank you
From: Bruce Bowler on 4 Mar 2010 13:11
On Thu, 04 Mar 2010 17:19:05 +0000, jeremy meduna wrote: > Bruce Bowler <bbowler(a)bigelow.org> wrote in message > <7va1k4FhiU1(a)mid.individual.net>... >> On Thu, 04 Mar 2010 14:59:09 +0000, jeremy meduna wrote: >> >> > Write a matlab function ciphertext=project7(plaintext, k) that >> > encrypts >> >> the plaintext using the Playfair cipher with k as the keyword. The >> >> alphabet is the 26 capital letters omitting Q to create the 5x5 >> >> matrix >> >> >> >> ex run: >> >> >> >> plain='HIDETHEGOLDINTHETREESTUMP'; >> >> key='PLAYFAIREXAMPLE'; >> >> project7(plain,key) >> >> >> >> ans= >> >> >> >> BMNDZBXDKYBEJVDMUIXMMNUVIF >> >> >> >> I have the 5X5 table figured out, I just do not know how to do the >> >> function? >> > Here is what I have so far... >> > >> > a=input('enter code key word as a string: '); b=['A':'Z']; b=='Q'; >> > b(b=='Q')=[]; >> > c=[a b]; >> > [b m n]=unique(c,'first'); >> > d=c(sort(m)); >> > e=reshape(d,5,5); >> > k=e' >> >> Have you tried any of the following... >> >> 1) talk to your classmates? >> 2) talk to your professor? >> 3) google? (I did, the first item that comes up looks *JUST* like your >> problem and partial solution and is dated 5 months ago) > > I have tried all of the following to include spending countless hours in > the lab trying to figure it out.....So please, if you are not going to > help stop replying to my posts. Thank you If you want a solution, I think you've come to the wrong place. If you want help, you've come to the right place. It looks like so far, you've got the 5x5 built properly. What parts of the next steps in the playfair algorithm are causing you problems. Please show us the code for what you have tried so far that doesn't work (in addition to the code, show what results you got and what results you expected to get...) |