Ave

Discussion of challenges you have already solved
cnhr.idol
Posts: 16
Joined: Wed Jun 20, 2007 5:31 am

Ave

Post 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;
}
go go
Barbossa
Posts: 2
Joined: Mon Oct 04, 2010 1:03 pm

Post by Barbossa »

I used the built-in Analysis Tools of Cryptool 1.4,
it took about 20 seconds to solve

:D
avrrobot
Posts: 51
Joined: Fri Mar 04, 2011 2:54 pm
Location: Germany

Post by avrrobot »

i did it with this website:
http://www.ivhp.de/files/caesar.htm
L0RI
Posts: 2
Joined: Fri May 27, 2011 10:38 am

Post 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));
}
}
}
rain1024
Posts: 27
Joined: Sat Jul 23, 2011 5:20 pm

..

Post 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.
mauricemoss
Posts: 3
Joined: Fri Oct 07, 2011 12:27 pm

Post 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!
JFox
Posts: 2
Joined: Sat Nov 05, 2011 6:58 pm

Post 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 :)
Zeneta
Posts: 1
Joined: Tue Jan 03, 2012 1:51 am

Post 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.
I am not sure if I am a hacker, but I surely love the art of coding.
wynk
Posts: 7
Joined: Tue Jan 03, 2012 7:59 pm

Post 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
timothy48342
Posts: 2
Joined: Mon Jul 30, 2012 5:01 am
Location: usa

Post 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
tiwe
Posts: 3
Joined: Thu Mar 05, 2009 2:09 pm

shell oneliner

Post 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
samsock
Posts: 1
Joined: Wed Aug 22, 2012 3:15 am

..

Post 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
b3ll4
Posts: 1
Joined: Tue Nov 13, 2012 7:52 pm

Post by b3ll4 »

I did it by hand too.
I think it was easy. :)
AgRaven
Posts: 13
Joined: Sun Feb 24, 2013 8:27 am

Post 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
User avatar
Grusewolf
Posts: 16
Joined: Sun May 29, 2011 7:58 pm
Location: Munich

solved in groovy

Post 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 ''
}
Post Reply