troubleshooting Question

Help on using PyGenere.py's functions

Avatar of JonKho83
JonKho83 asked on
PythonProgramming Languages-OtherMath / Science
6 Comments1 Solution677 ViewsLast Modified:
Dear all,

Currently I am trying to use this class, PyGenere.py found here and my main aim is to produce an GUI program which is very similar to the website given earlier with few improvements such as selecting text files on keywords, encrypted text and freq. distribution for each language.

For now, I need some help on using the methods found in PyGenere.py class.

I been trying to figure out on using it.. Here are the codes that I written..
from pygenere import *

plaintext = 'Attack from dawn.'
key = 'king10'
ciphertext = Vigenere(plaintext).encipher(key)
print "Actual text as followed. " + plaintext
print "Encrypted test using key word: king10 as followed. " + ciphertext
print "Decrypted text as followed. " + Vigenere(ciphertext).decipher(key)

print "Using VigCrack to display keyword: " + VigCrack(ciphertext).crack_codeword()
print "Showing the actual message: " + VigCrack(ciphertext).crack_message()

Here is the output..
>>> 
Actual text as followed. Attack from dawn.
Encrypted test using key word: king10 as followed. Kbgggn pzbs hdgv.
Decrypted text as followed: Attack from dawn.
Using VigCrack to display keyword: ZBSNO
Showing the actual message: Laotso ohoe icoi.
>>> 

And you can see the last two results is not what I expected.
It is supposed to be..
Using VigCrack to display keyword: king10
Showing the actual message: Attack from dawn.

Thanks
ASKER CERTIFIED SOLUTION
gelonida

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros