| Welcome to Crypto. We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| Cryptarithms | |
|---|---|
| Topic Started: Apr 3 2008, 04:52 PM (239 Views) | |
| jdege | Apr 3 2008, 04:52 PM Post #1 |
|
Elite member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
The ACA has a type of problem called Cryptarithms: a mathematical cipher in which a simple arithmetic problem is run through a simple substitution, with different letters representing the different digits. These are expressed in a single line:
But this is simply an abbreviation for a multi-line problem:
The problems include multiplication, long division, square and cube roots, and can be base 10, 11, or 12. Keys should spell out a word or words, when ordered 0-9, 9-0, 1-0, or 0-1. It's a problem that lends itself to exhaustive search. There are only 10!, 11!, or 12! possibilities. So I wrote one. I enter the one-line form of the problem into a textfile. I edit it so as to create the multi-line form. Then from the multi-line form, I extract a number of simple equations. These I also place in the file, marked with a ':' at the beginning of the line.
If the problem is base 11 or 12, I add a line containing the base, marked with a # at the beginning. The complete file will look like:
Then I run my little program. It will read the line beginning with '#' to set the numeric base. It will read all the lines beginning with ':', and parse them to create the equations that need to be checked for each possible key (using a very simple parsing function - but it doesn't need to be more sophisticated). It will then identify the letters in the ciphertext, and then run through all the possible permutations, checking each to see if it results in all of the equations evaluate to true. If they do, it prints the key.
On my own desktop, the above program running on the above file takes 35 seconds to produce the key "HOBNAILERS", which since this was a problem with a 0-9 key order, is the solution. If it had been a problem with a 9-0 key order, I'd have had to reverse the letters to get the solution. Or if it had been a 1-0 or 0-1 key order, I'd have had to move the first letter to the last spot, or moved the first letter and then reversed them. Thinking about it, it'd be pretty easy to modify the program to output the keys in a specified order, instead of always in 0-9. But this was meant to be a quick-and-dirty solution to a particular problem, not a production program, so just as I found it easier to manipulate the input to produce easily-parsed equations, it's easy enough to reorder the output into the desired form. If I do go back and revisit this, I will probably add a way of specifying particular values for selected letters. It's often obvious, for example, that a given letter must represent a 0 or a 1. And if I could set them, when I can see them, I could remove them from the set being permuted. It'd not make much of a difference to the base-10 problems. But for the base-11 and base-12 problems, it could make things quite a bit faster. Because if base-10 takes 35 seconds on my computer, base-11 would take >6 minutes and base-12 would take >1 hour. |
| When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl. | |
![]() |
|
| Revelation | Apr 11 2008, 04:38 PM Post #2 |
|
Administrator
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
That's a nice puzzle. I'm sure I've seen simplified forms of this in a puzzle book. Your application is nice too! Wouldn't want to do that cipher manually
That's a good idea. And if you'd really want to go through with this, I'd add educated guesses too. Like saying that B is probably 6, so the permutation of B starts with B being 6. |
|
RRRREJMEEEEEPVKLWENFNVJKEEEEEAOLKAFKLXCFZAASDJXZTTTTTTTLSIOWJXMOKLAFJNNKFNXN RAGRBAQEMHIGDJVDSEOXVIYCELFHWLELJFIENXLRATALSJFSLCYTKLASJDKMHGOVOKAJDNMNUITN RRRRLJVEEEEECLYVYHNVPFTAEEEEEMWLMEIRNGLARWJAKJDFLWNTIERJMIPQWOTZEOCXKNUBNXCN RJIRPOWEANFUSNCZVDVZNMSFEKLOEPZLDKDJWSAAAAAAAOERHJCTNCKFRIMVKSOFOMKMANREWNBN RZUDRGXEEEEENFQIDVLQNCKNEEEEEDGLLLLLLAWIOSNCDARLODMTOEJXMILDFJROTKJSDNLVCZNN | |
![]() |
|
| jdege | Apr 11 2008, 09:26 PM Post #3 |
|
Elite member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Yep. If you can guess it down to where you're searching for nine or fewer digits, the search is near-instantaneous, so WAGS can be done interactively. |
| When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl. | |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · General · Next Topic » |





![]](http://209.85.122.85/static/1/pip_r.png)



4:08 PM Nov 25