Skip to content

Me when i don't know that this is ROT13, but this will be helpful if you're trying to cracking ROT13 :)

Notifications You must be signed in to change notification settings

Bang1338/solving-dorateatcheese-message-rot13

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Solving Dorateatcheese's message (ROT13)

I hate number 13.

Story

2 days ago I just smashing my keyboard, but suddenly my friend Dorateatcheese, sending weird message.

No one know what he saying.

Until Jan 18th 2023, Dorateatcheese said in Zalo: You will never decode my message, this challenge me.

I tried CyberChef, but... doesn't detect anything.

How I decoded it

To find it, we need to know the magic. I'll take Uryyb thlf jung'f hc? as example.

  • First, find the magic. I found the word jung'f look familiar to that's or what's
  • Second, see the range of each word in ASCII Table. I take the range of j with t and w
| j | 106 + 10 = 116  | t |
| j | 106 + 13 = 119  | w |

Next, take the range of u with h

| u | 117 - 13 = 104  | h |

And continue, we have:

| j | 106 + 13 = 119  | w |
| u | 117 - 13 = 104  | h |
| n | 110 - 13 =  97  | a |
| g | 103 + 13 = 110  | t |
| ' | N O T   U S E D | ' | if this is space or not a char, don't.
| f | 102 + 13 = 115  | s |

This have a lot of number 13 (i hate that number), so the offset is +13 and -13

  • Third, I try with other character, however... If we take z for example, the ASCII code is 122, if we using +13 this will go to other one.

So, we have to use -13 instead.

  • Note: If UPPERCASE CHAR, the range must be 65 (A) to 90 (Z). if lowercase char, the range must be 97 (a) to 122 (z). Or else it won't be working. I fully solved in Notepad (i wanted to do it on Excel, but lazy).

Later I coded C++ code to solve the Dorateatcheese puzzle. You can check here.

Process making C++ code

Since i'm too lazy to do it by hand, I've to do it in C++

// offset is int.
if(s[i] >= 'a' && s[i] <='z' || s[i] >= 'A' && s[i] <='Z'){
    if(s[i] + offset >= 'a' && s[i] + offset <='z' || s[i] + offset >= 'A' && s[i] + offset <='Z')
        cout<<char(s[i] + offset);
    else if (s[i] - offset >= 'a' && s[i] - offset <='z' || s[i] - offset >= 'A' && s[i] - offset <='Z')
        cout<<char(s[i] - offset);
}

However, when I run it, this will fail on second rule:

  • If UPPERCASE CHAR, the range must be 65 (A) to 90 (Z). if lowercase char, the range must be 97 (a) to 122 (z). Or else it won't be working. So, I recode it.
for(int i=0; i<=s.size(); i++){
        if(s[i] >= 'a' && s[i] <='z'){
            if(s[i] + offset >= 'a' && s[i] + offset <='z')
                cout<<char(s[i] + offset);
            else if (s[i] - offset >= 'a' && s[i] - offset <='z')
                cout<<char(s[i] - offset);
        }
        else if (s[i] >= 'A' && s[i] <='Z'){
            if(s[i] + offset >= 'A' && s[i] + offset <='Z')
                cout<<char(s[i] + offset);
            else if (s[i] - offset >= 'A' && s[i] - offset <='Z')
                cout<<char(s[i] - offset);
        }
        else if (s[i] == ' ') cout<<" ";
        else cout<<s[i];
    }

What this thing do?

if(s[i] >= 'a' && s[i] <='z'){

}
else if (s[i] >= 'A' && s[i] <='Z'){

}
  • If the current i is valid lowercase char or UPPERCASE CHAR, we do something.
if(s[i] + offset >= 'a' && s[i] + offset <='z')
        cout<<char(s[i] + offset);
else if (s[i] - offset >= 'a' && s[i] - offset <='z')
        cout<<char(s[i] - offset);
  • This is for lowercase char
  • If we take current character plus the number (offset) we shift is valid char, we print out.
  • Else if we take current character minus the number (offset) we shift is valid char, we print out.
if(s[i] + offset >= 'a' && s[i] + offset <='z')
        cout<<char(s[i] + offset);
else if (s[i] - offset >= 'a' && s[i] - offset <='z')
        cout<<char(s[i] - offset);
  • Same thing as lowercase char, but this is for UPPERCASE CHAR
else if (s[i] == ' ') cout<<" ";
else cout<<s[i];
  • If it have space , we print
  • Else we print something else (like @)

The end...?

  • After done a while, I already have nightmare on number 13.
  • When I played CyberChef a while, I found out ROT13. I was thinking: oh man not number 13..., I drag it and...

  • So, that entire time, Dorateatcheese USING ROT13?????
  • Oh well, this is worth a try.

About

Me when i don't know that this is ROT13, but this will be helpful if you're trying to cracking ROT13 :)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages