Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add Playfair #514

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open

Conversation

RotationMatrix
Copy link

Close but not quite cracking yet. Think the issue lies around plaintext scoring.

Ended up using a Threshold Acceptance algorithm in this implementation (random-restart hill-climbing did not seem very effective as the search space is so huge.)

C++ code for the cracker so far is here. At least the C++ is running quickly (>100K attempts in 5 seconds.)

@RotationMatrix
Copy link
Author

RotationMatrix commented Oct 28, 2020

Replaced the C++ implementation with a Python one. It seems a bit slower as expected though the decryption function still appears to be churning through ~8K rounds a second.

Known Issues

  • Scoring is not working and the TA optimization does not converge. I think the issue is Playfair scrambles digraphs instead of letters, thereby reducing the effectiveness of letter frequency (the search space appears to have very little slope.) I plan to try using bigram scoring at some point. Sounds like @SkeletalDemise is already working on bigrams, so will wait to incorporate that here to avoid duplication.
  • Padding "x"s in the ciphertext are not removed after decryption. I have a method for accomplishing this in the works. The implementation will error on leaving padding "x"s in some ambiguous cases.
  • Additional prints and snippets for caveman debugging will be removed/cleaned up once this is working. (example)

@RotationMatrix RotationMatrix marked this pull request as ready for review October 28, 2020 12:59
@bee-san bee-san added the hacktoberfest Spoopy hacktoberfest! label Oct 30, 2020
@SkeletalDemise SkeletalDemise added hacktoberfest-accepted Accepted for Hacktoberfest and removed hacktoberfest Spoopy hacktoberfest! labels Oct 30, 2020
@bee-san
Copy link
Member

bee-san commented May 20, 2021

Hey we're changing from MIT to GPLv3 because some of our projects are licensed with that, do you approve? If you do not approve we will be forced to delete your code and rewrite it 😢

By approving of this change, you are agreeing to re-license the code you wrote under GPLv3.

@RotationMatrix
Copy link
Author

Hi! Yes, I approve of this code being re-licensed under GPLv3.

If possible I will try to finish this contribution based off of the last MIT version of Ciphey, so that anyone may use it under those terms as well. And then I will write patches so it can be merged to master. 😄

@SkeletalDemise
Copy link
Contributor

Did this end up working or no? I thought that it wasn't complete but I can't remember.

@RotationMatrix
Copy link
Author

RotationMatrix commented May 19, 2022

No, it is not working currently. I can't get the algorithm to converge on the right key. The optimization algorithm as it is now finds a "good" solution to the cost function. However the cost function never has the key on a local-minima (or maxima) so it is never found.

Please let me know if you think of anything that could make this work. I'm stumped.

@SkeletalDemise
Copy link
Contributor

Please let me know if you think of anything that could make this work. I'm stumped.

Try using a regular hill climbing algorithm instead of a threshold acceptance algorithm as it's simpler. I'm guessing you messed something up with the implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Accepted for Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants