Solved

Vigenere Cipher - variation  - Part II

Posted on 2010-09-07
6
898 Views
Last Modified: 2012-05-10
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_26433255.html#a33622117




If you can show me how your function works wiith examples for each case......starting with

Standard Vigenere  (A...Z)

 lowercase alphabet    'a' - 'z',    
 numeric                        0..9
 special characters      ~`!@#$%^&*()_-+=|\}]{[:;"'?/>.<,
 Control characters


I call your function for the Standard Vigenere  (A...Z) using:

Encrypt
Memo1.Lines.Text:= VigenereExEncrypt(Trim(Memo1.Lines.Text), edtKey.Text);

Decrypt
Memo1.Lines.Text:= VigenereExEncrypt(Trim(Memo1.Lines.Text), edtKey.Text, True);

It looks like it may be encrypting it, but its not using just A..Z, it is showing other characters (special).  And the decrypt does not work.

thanks
0
Comment
Question by:Looking_4_Answers
  • 2
  • 2
  • 2
6 Comments
 
LVL 45

Expert Comment

by:aikimark
ID: 33622353
What version of Delphi are you using?

You didn't answer that question in the previous thread.  Maybe you'll answer it in this thread.
0
 
LVL 16

Expert Comment

by:CodedK
ID: 33625448
Hi Looking_4_Answers,

As i said on the previous post there is a fault in this logic.


1) You need to know what method was used for encryption in order to decrypt it.
2) The whole Vigenere function should change to something completely different... It should NOT output any letters... Look at the example :

Lets say that you have to encrypt the word A717.
And you use some key that normally will encrypt A717 to 94FJ.

Now A717 word will be encrypted with the "leave A-Z untouched" mode,
OUTPUT :
A717 will be A4FJ.


If we know that the decryption we should use IS the "leave A-Z untouched",
then we should not mess with the first letter (since it wasn't encrypted) but we cannotnot decrypt also the 3rd and the 4th letter that were encrypted! (since  "leave A-Z untouched" mode is on)

So final output :

A7FJ   <-  the only character that was successfully decrypted was the second one!



Solution:

When "Leave A-Z untouched mode" is used we should also block the encrypted output of normal letters.
example :

if '%' -> C based on some key then we should output "-C" ... Some letter "signed" with a special character so we can tell the decryption function if you see this then decrypt it.
This would be at least idiotic.
Or a shift in the table should happen dynamically.
In another words dynamically changing the key word.
This will be equivalent with chaos.

Mixing encrypted text with plain-text don't play well with a decryption function !


Correct me if I am wrong.
Hope this helps.
0
 
LVL 45

Expert Comment

by:aikimark
ID: 33626424
@CodedK

I've been interpreting the requirement as always encrypt [A..Z] and, optionally, encrypt the other character sets.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 16

Accepted Solution

by:
CodedK earned 500 total points
ID: 33629144
The problem still stands only reversed.

Plaintext : @Code  
Encrypted with a key :  @$#G4  [mode : encrypt only A-Z, character '@'  was not encrypted]

Decryption is impossible since  "$" and "#" are also special characters. The function cannot decide which character is encrypted and which is plain text.
0
 

Author Comment

by:Looking_4_Answers
ID: 33666344
ok, i dont undertand why it matters, but its both Delphi 7 & Delphi 2010
0
 

Author Comment

by:Looking_4_Answers
ID: 33666356
I am reviewing and testing and will report back soon, thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now