Solved

Vigenere Cipher - variation  - Part II

Posted on 2010-09-07
6
895 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

20 Experts available now in Live!

Get 1:1 Help Now