Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Vigenere Cipher - variation  - Part II

Posted on 2010-09-07
6
901 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to center only a line in richedit? 4 61
drawing animated level bar based on numbers 3 103
Find and Replace Stream with 0s 8 69
Twebbrowser add css to the header 3 27
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

856 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