Page 1 of 2

Ave

Posted: Wed Aug 12, 2009 9:30 am
by cnhr.idol
/* a~y:97~122 by cnhr.idol*/
#include<iostream>
#include <string>

using namespace std;
int main()
{
int code_end;
int * word = new int[200];
char * code = new char[200];


cout<<"Please enter to The Crypto Code:"<<endl;
cin.getline(code,199);


for(int i=0;true;i++)
{
word=code;
if(code==0)
{
code_end = i;
break;
}
}

for(int j=0; j<code_end;j++)
{
if (word[j]<97 || word[j]>122)
{
}
else
{
word[j]=word[j]+17;
if(word[j] > 122)
word[j]-=26;
code[j]=word[j];
}
}
cout<<" Code_End is : "<<code_end<<endl;
cout<<"Code_Answer is :"<<endl;
cout<<code<<endl;

return 0;
}

Posted: Mon Oct 04, 2010 2:31 pm
by Barbossa
I used the built-in Analysis Tools of Cryptool 1.4,
it took about 20 seconds to solve

:D

Posted: Sun Mar 13, 2011 3:14 pm
by avrrobot
i did it with this website:
http://www.ivhp.de/files/caesar.htm

Posted: Sun May 29, 2011 1:55 pm
by L0RI
I used Java:

public class caesar
{
public String caesar(String in, int Offset){
String s=in.toLowerCase();
String out="";
for(int i=0;i<s.length();i++){
if(s.charAt(i)<61 || s.charAt(i)>122){
out=out+s.charAt(i);
continue;
}
char t=(char) (s.charAt(i)+Offset);
if((s.charAt(i)+Offset)>122){
t=(char)(t-26);
}
out=out+t;
}
return out;
}
public void caesarBruteForce(String s){
for(int i=1;i<27;i++){
System.out.println("C"+i+": "+caesar(s,i));
}
}
}

..

Posted: Sun Jul 31, 2011 3:32 pm
by rain1024
they are nice ways.

I solve it by hand with some small function excel

I try to repace each letter to find meaning full sentences. 8)

I'm going to test Cryp Tool software. It seems powerful.

Posted: Wed Oct 12, 2011 5:23 pm
by mauricemoss
I did it by hand, too, but by the help of the following Python Script:

Code: Select all

alphabet_source = open('alphabet.txt', 'r')
alphabet = {}
for line in alphabet_source:
	line = line.strip() 
	zuordnung = line.split(" ") 
	alphabet[zuordnung[0]] = zuordnung[1]
alphabet_source.close()
	
input_sentence = list('cqrb lryqna rb fjh, fjh qjamna cqjw axc cqracnnw. qnan, hxd wnena twxf qxf oja cx bqroc! xq kh cqn fjh, cqn jwbfna rb mnjmvjwblqnbc.')
print "".join(input_sentence)
index = 0
while index < len(input_sentence):
	if input_sentence[index] in alphabet:
		input_sentence[index] = alphabet[input_sentence[index]]
	index += 1
print "".join(input_sentence)
input()
Where I exchanged the letters in the alphabet.txt one after another until it made sense (I started by finding the words "the answer is").

But after testing CryptoTool (now in 2.0), the crypto challenges seem not that hard anymore! Really powerful!

Posted: Sun Nov 06, 2011 1:00 pm
by JFox
I for one used JavaScript :) :

Code: Select all

var decode = (function () {

    var alphabet = "abcdefghijklmnopqrstuvwxyz";
    var alphaIndices = {};
    for (var i = 0; i < 26; i++) {
        alphaIndices[alphabet[i]] = i;
    }

    return function decode(s) {
      var decodedChars = [];
         for(var key = 0; key < 26; key++) {
             for(var i = 0; i < s.length; i++) {
                 var alphaIndex = alphaIndices[s[i]];
                 if(alphaIndex == null) {
                     decodedChars[i] = s[i];
                 } else {
                     decodedChars[i] = alphabet[(alphaIndex + key) % 26];
                 }
             }
             console.log(decodedChars.join(""));
         }
    }

})();

decode("cqrb lryqna rb fjh, fjh qjamna cqjw axc cqracnnw. qnan, hxd wnena twxf qxf oja cx bqroc! xq kh cqn fjh, cqn jwbfna rb mnjmvjwblqnbc");
:D :)

Posted: Tue Jan 03, 2012 6:13 am
by Zeneta
assume the answer is English and the encryption is 1:1, character by character...

the answers are obvious by using basic character counting. Letters like A,E,T,H,R are therefore very common.

Posted: Wed Feb 01, 2012 9:57 pm
by wynk
My ruby solution:

Code: Select all

input = "cqrb lryqna rb fjh, fjh qjamna cqjw axc cqracnnw. qnan, hxd wnena twxf qxf oja cx bqroc! xq kh cqn fjh, cqn jwbfna rb mnjmvjwblqnbc."
for i in 1..25 do
	input.each_byte { |c|
		if (97..122).member?(c)
			print (97 + (c - 97 + i) % 26).chr
		else
			print c.chr
		end
	}
	puts ''
end

Posted: Mon Jul 30, 2012 5:31 pm
by timothy48342
I noticed in 3 or more puzzles so far the last 4 words were a statement about the answer directly. Such as in this case, "the answer is ______" and so the 4th, 3rd, and 2nd words from the end have legth 3, 6, and 2 respectiveley. So I assumed that they just might be "the answer is" and plugged in those letters and, lo and behold enough of the puzzle was complete to start filling in the gaps.

I don't know long it took exactly, but it was less time to do it manually than to decide what language to code in.

Now, if I tried to code a solver for this or any of the other cryptograms, it would have taken me HOURS! (or possibly "fail.") So I really should do that, because I need the skill building there. But they could make the solutions harder to do the ol' fashion way to force us to code something.

By "harder" I mean don't use simple language like "the answer is" Don't start sentances with "the" "this" "that" or anything with "th" or "wh". Use some word that are not in normal peoples vocabulary.

(BTW, I didn't even know that this was any kind of ROT puzzle(as in ROT-17) until I had solved the part that said, "way harder then rot thirteen.")

Don't get me wrong... Some of the chalanges on here are hard, hard, hard! I am thoughly enjoying myself working on them. My point here is only that, because I was able to do this using Notepad.exe, it didn't inspire me get into writing a program to do it.

As far as the dynamics of the problem(s), great! Even this one. I'm just saying the answer(s) itself(themsleves) need(s) to be more cryptic to keep people like me from treating it as a basic thinking puzzle instead of a coding puzzle.

I guess if I had known it was a rot-XX puzzle, I might have written a quick cycle-through-all-possible-rotXX program and got the answer in about the same time, but I thought this was a any-letter-can-be-any-other-letter type so I dug in and did it manually. (I guess I wouldn't have known how to code that. I'm thinking maybe do some sort of search for pattern in a dictionary, but that's beyond me at this point.)

So, if the suggestion is taken to make the answers more cryptic... I won't be able to solve any on them!! LOL
Oh, well. Having fun. Cheers to ya!

~timothy48342

shell oneliner

Posted: Sun Aug 19, 2012 10:53 pm
by tiwe
in="cqrb lryqna rb fjh, fjh qjamna cqjw axc cqracnnw. qnan, hxd wnena twxf qxf oja cx bqroc! xq kh cqn fjh, cqn jwbfna rb mnjmvjwblqnbc."; a=abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz; for i in $(seq 1 25); do echo "$in" | tr ${a:0:26} ${a:$i:26}; done

..

Posted: Wed Aug 22, 2012 3:11 pm
by samsock
i did it by hand in notepad, never heard of CryptoTool software either, must try it out soon
i started by guessing which words were which using logic
then i started to understand the byte shift, and decrypted the rest of the cipher :D

Posted: Mon Feb 18, 2013 12:09 pm
by b3ll4
I did it by hand too.
I think it was easy. :)

Posted: Sun Jul 21, 2013 12:59 pm
by AgRaven
I should not do these late at night with scotch... I'm learning c++ by solving these challenges, and had particular difficulty getting an alphabet 'wrap around' with modulo calculations (which I learned from the text to the feedback cyphers - loved that when I saw how it worked). I got the answer, but all my a's remained j's and I was damned if I'd enter the answer before properly solving this.

BTW - As per many folks, my first step was to manually shotgun the first word to get the shift. A 26 combo brute force loop would also work. I might alter this program so I can use it on any caesar in future.

In any case, here's the code:

Code: Select all

#include <iostream>
#include <string>
using namespace std;

int main ()
{
    string s="-cyphertext goes here-";
    int j=s.length();
    for (int i=0; i<=j; i++)
    {
        char c=s[i];
        int k=c;
        k=(((k-97+17)%26)+97);
        char h=k;
        if (h <= 0x7a && c >=0x61)
            cout << h;
        else
            cout << c;
    }
    return 0;
}
-Ag

solved in groovy

Posted: Sun Apr 06, 2014 3:26 pm
by Grusewolf
I produced all 26 possibilities for the key of caesar encryption and looked for something readable.
'AVE' gave the hint for Caesar.

Code: Select all

def cipher = 'cqrb lryqna rb fjh, fjh qjamna cqjw axc cqracnnw. qnan, hxd wnena twxf qxf oja cx bqroc! xq kh cqn fjh, cqn jwbfna rb mnjmvjwblqnbc.' as byte[]

def asciiBase = (byte) 'a'
for(key in 0..26) {
    for(i in 0..<cipher.size()) {
        if(cipher[i] == ' ') {
            print ' '
        } else {
            def plain = asciiBase + (((cipher[i]-asciiBase) + key) % 26)
            print ((char)plain)
        }
    }
    println ''
}