Ave
Ave
/* 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;
}
#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
i did it with this website:
http://www.ivhp.de/files/caesar.htm
http://www.ivhp.de/files/caesar.htm
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));
}
}
}
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));
}
}
}
-
- Posts: 3
- Joined: Fri Oct 07, 2011 12:27 pm
I did it by hand, too, but by the help of the following Python Script:
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!
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()
But after testing CryptoTool (now in 2.0), the crypto challenges seem not that hard anymore! Really powerful!
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");
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
-
- Posts: 2
- Joined: Mon Jul 30, 2012 5:01 am
- Location: usa
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
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
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
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:
-Ag
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;
}
solved in groovy
I produced all 26 possibilities for the key of caesar encryption and looked for something readable.
'AVE' gave the hint for Caesar.
'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 ''
}