User avatar
expandables
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson

Lets have fun with ROT-13

Fri Dec 04, 2015 12:04 am

Gb trg gb gur bgure fvqr!
:twisted:
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.

danjperron
Posts: 3501
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 1:26 am

Code: Select all

#!/usr/bin/python

import sys



if len(sys.argv) != 2:
  print('usage :\n\t rot13.py  "rot code"')
else:
  dstring=""
  for i in sys.argv[1]:
     if i.isalpha():
       if i.isupper():
         Ucase = ord('A')
       else:
         Ucase = ord('a')
       weight = (ord(i) - Ucase)
       dstring+=  chr( ((weight + 13) % 26) + Ucase)
     else:
        dstring+=i;
  print(dstring)

Code: Select all

pi@Pi2 ~ $ python rot13.py 'Gb trg gb gur bgure fvqr!'
To get to the other side!

danjperron
Posts: 3501
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 2:27 am

bash version

Code: Select all

#!/bin/bash

chr() {
printf \\$(printf '%03o' $1)
}

ord() {
  printf -v ordr "%d" "'$1" 
}

SIZE=${#1}

TXT=$1
RTXT=""
for(( i=0; i<$SIZE; i++ ))
do
  C=${TXT:i:1}
 if ! [[ "$C" =~ [^A-Z] ]]; then
   ord "$C"
   NewC=$((((($ordr  - 65) + 13) % 26) + 65));
   RTXT+=`chr "$NewC"`
 elif ! [[ "$C" =~ [^a-z] ]]; then
   ord "$C"
   NewC=$((((($ordr  - 97) + 13) % 26) + 97));
   RTXT+=`chr "$NewC"`
 else
   RTXT+=$C
 fi
done

echo $RTXT

Code: Select all

pi@Pi2 ~ $ ./rot13.sh 'Gb trg gb gur bgure fvqr!'
To get to the other side!
pi@Pi2 ~ $ 
Abj gel gb qb gur P irefvba!

User avatar
expandables
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 2:53 am

Not bad! You wrote all of that code or copied it?
:twisted:
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.

danjperron
Posts: 3501
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 2:54 am

I'm watching Hockey on the TV and I did wrote all the code from scratch!

danjperron
Posts: 3501
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 2:56 am

The only thing I cut and paste are the chr and ord function for bash!

User avatar
expandables
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 3:09 am

danjperron wrote:I'm watching Hockey on the TV and I did wrote all the code from scratch!

Code: Select all

V jvfu v unq lbhe oenva
:twisted:
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.

User avatar
scruss
Posts: 3151
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Let's have fun with ROT-13

Fri Dec 04, 2015 3:37 am

Code: Select all

rpub 'Of course, the *right* way to do it is ...' | ge '[N-Z][A-M][n-z][a-m]' '[A-M][N-Z][a-m][n-z]'
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 3:37 am

How about we have fun with ROT-26 instead.

danjperron
Posts: 3501
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 3:40 am

Code: Select all

pi@Pi2 ~ $ ./rot13.sh 'V jvfu v unq lbhe oenva'
I wish i had your brain
I start doing computer stuff when I was in High school . Learning LOGO using a mini computer with a TTY terminal. The one you see on old film typing on paper and making a lot of noise.

B.T.W. I start to learn C in the beginning of 1982. So I do have a lot of baggage under my belt.

Just experience and a lot of practice. You will get there
Last edited by danjperron on Fri Dec 04, 2015 4:04 am, edited 2 times in total.

danjperron
Posts: 3501
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 3:43 am

ok I found this site http://rot26.org/

Now I will need to figure it out

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 3:49 am

danjperron wrote:ok I found this site http://rot26.org/

Now I will need to figure it out
It's twice as secure as ROT-13!

User avatar
expandables
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 3:53 am

ame wrote:How about we have fun with ROT-26 instead.
What's "You are an idiot" in Rot-26?
Wait i think i know.... :lol:
:twisted:
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.

danjperron
Posts: 3501
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 4:00 am

:lol: :lol: :lol:

Yep! the decoder is so obvious.

B.T.W. it is easy to change my code from ROT-13 to ROT-n . Just change the (+13) to a +N where N is the ROT-N value.

;-)

User avatar
DougieLawson
Posts: 38853
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 9:16 am

ame wrote:How about we have fun with ROT-26 instead.
ROT26 is not much more or less secure than ROT1 through ROT25.
Since it's a Caesar cypher why don't we use use Google translate and just convert everything to Latin as that's better obfuscation.

Let's start with
Nil illegitimus carborundum.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

dan3008
Posts: 1172
Joined: Wed Aug 15, 2012 1:05 pm

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 10:53 am

DougieLawson wrote: Nil illegitimus carborundum.
Dont let the B******* grind you down
I happen to like this quote and use it every chance I get.

or google translates version:
There is nothing illegitimate Rats
dan3008 wrote:Pays your money, takes your choice

danjperron
Posts: 3501
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 12:21 pm

Instead of latin you could use a language that is not speak too much and google translator doesn't know about.

The problem with that approach is to know the language.

There is some language in my country that not too many people speak.

Like the Inuit people with the Inuktitut language and there multiple dialecs. Just writing a letter in this and you will have hard time to find somebody in Europe who will be able to translate it.
Capture d’écran 2015-12-05 à 07.45.32.png
Inuktitut to english
Capture d’écran 2015-12-05 à 07.45.32.png (10.59 KiB) Viewed 2534 times
Update. The Inuktitut characters do not show up on my Tablet. I made an image instead. That's another good way to hide stuff ;-)
Last edited by danjperron on Sat Dec 05, 2015 12:52 pm, edited 3 times in total.

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 12:27 pm

danjperron wrote:Instead of latin you could use a language that is not speak too much and google translator doesn't know about.

The problem with that approach is to know the language.

There is some language in my country that not too many people speak.
Québécois?

;)

danjperron
Posts: 3501
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 12:39 pm

Québécois?
Et oui!



1 - You just replace the latin alphabet with the inuktitut caracter which looks odd but easy to figure it out.

Or the second method is that you translate to inuktitut and then you swap the caracter into the latin equivalent.

Since I don't speak Inuit I will be stuck with #1

User avatar
DougieLawson
Posts: 38853
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 12:53 pm

ame wrote:
danjperron wrote:Instead of latin you could use a language that is not speak too much and google translator doesn't know about.
Québécois?

;)
That was the trick the United States used during WW2 with the Navajo "code talkers".
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
blachanc
Posts: 466
Joined: Sat Jan 26, 2013 5:03 am
Location: Quebec,canada(french)

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 1:07 pm

DougieLawson wrote:
ame wrote:
danjperron wrote:Instead of latin you could use a language that is not speak too much and google translator doesn't know about.
Québécois?

;)
That was the trick the United States used during WW2 with the Navajo "code talkers".
Douggie:
Try this one:

danjperron:

Code: Select all

la game devait être plate en criss..
Even a French from France would not get it...

but the translation is:

Code: Select all

The game must have been very boring
Google translate says:

Code: Select all

the game had to be flat criss
Ben

PS: Dan, I am also impressed by your code (especially by the bash version. Where's the perl version ;) ?)
Autism/Asperger syndrome: what is your score on this quiz?
http://www.raspberrypi.org/forums/viewtopic.php?f=62&t=70191

danjperron
Posts: 3501
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Lets have fun with ROT-13

Fri Dec 04, 2015 2:56 pm

I'm not a perl guy!

Mostly C and C++ .

Well like the Navaho we let one person out and she teaches how to decipher our language ;-). Nicelly by the way .

https://www.youtube.com/watch?v=3Mp_j3KZyXw

She gaves me a good smile on my face.

User avatar
scruss
Posts: 3151
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Lets have fun with ROT-13

Mon Dec 07, 2015 2:03 pm

danjperron wrote: 1 - You just replace the latin alphabet with the inuktitut caracter which looks odd but easy to figure it out.
Though if you knew some of the older forms of stenographer's shorthand, Canadian Aboriginal syllabic writing was based on that. So there's a chance you could sound words out, even if you didn't know what they mean.

You can really mess with people by splitting the encoding of the characters from the appearance of the glyphs in a TrueType font, like I did here: TimesNewROT13.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

Return to “Off topic discussion”