Filed under coding, linux, perl
[UPDATE]:
The new version is 0.2 and supports decryption. Have fun!
Hi guys,
after creating transpos-cipher and shift-cipher I thought of a way to really encrypt sentences in a reasonable way. I don’t have the knowledge to create an advanced Public-Private-Key system but I think I now created a simple but quite safe way to crypt symmetrically.
Here is the script: shift-cipher-ng
shift-cipher-ng works with STDIN like the predecessors, but uses a lowercase string as key to crypt the sentence. For example:
ap0calypse@shu:/tmp> echo "my very difficult sentence" | \
./shift-cipher-ng -k complicatedkey
[om kpza wmipmawzf dmptxrfo]
ap0calypse@shu:/tmp> echo "om kpza wmipmawzf dmptxrfo" | \
./shift-cipher-ng -d complicatedkey
[my very difficult sentence]
Well, now to the internals:
In the first step, we split the input-sentence to get an array:
[m][y][ ][v][e][r][y][ ][d][i][f][f][i][c][u][l][t][ ][s][e][n][t][e][n][c][e]
Now, we take the key and generate an array of the same length with the replicated key:
[c][o][m][p][l][i][c][a][t][e][d][k][e][y][c][o][m][p][l][i][c][a][t][e][d][k]
In the next step, we take the arrays index-by-index. The corresponding key tells the program, where the alphabet starts. So the resulting array looks like this:
[o][m][ ][k][p][z][a][ ][w][m][i][p][m][a][w][f][z][ ][d][m][p][t][x][r][f][o]
For more information start the program with the “-h”-parameter. Enjoy!
I just started writing my first poem in Perl ever. It isn’t as beautiful and clever as many others, but I’m a bit proud of it, mainly because it is my first one
. It seems a bit rude and brutal but it wasn’t intended to be in the beginning … it just happened
. Here it is:
#!/usr/bin/perl
$i = "am alone again ...";
for ($ever) {}
until ($i) {die}
@you = push @me, $away and split /my/, @heart;
while ("you are asleep") {
$i = chop ($YOUR, $FUCKING, $HEAD);
close($your_door) or ($this, $night) = ($your, last)
}
Works with Perl 5.8.8. Comments are welcome
Filed under coding, linux, perl
One day after completing transpos-cipher, I started writing this little script: transpos-decipher
As the name says, it’s the reverse process to transpos-cipher. It works exactly the same way. Start it with the “-h”-switch to get help. Enjoy!
Filed under coding, linux, perl
After reading an article on transposition cipher on Wikipedia I tried to write a small script which allows me to crypt sentences this way. The result is transpos-cipher which is written in Perl.
You can get an overview of what the script does, if you run it with the “-h”-parameter.
This should be enough information to understand what it does. If you still aren’t aware of what the heck this crap is doing, take a look at the article at Wikipedia mentioned above.
I guess I’ll try to write a script to reverse that process very soon. Or maybe someone else wants to give it a try?
Have fun!
Well folks, today is the last day of my project “2 weeks of vegetarianism”. I wanted to give it try to see how difficult it is. It turned out to be not that hard as I thought in the beginning. Of course, there were some situations which forced some abdication, but that didn’t happen very often. Now that these two weeks are over I ask myself: Should I continue?
Filed under coding, linux, perl
No problem! Here is the solution: filespam
filespam is a small perl script which gives you the possibility of creating many empty files at once in a directory you specify. The file names are random. Here an example:
ap0calypse@shu:/tmp> filespam -n 20 -d /tmp/testdir/
20 spam-files created in /tmp/testdir/
ap0calypse@shu:/tmp> ls -l /tmp/testdir/
total 0
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 01o34n9YUk_4
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 @0IH9LUTll_19
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 15giDUJwcj_7
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 1@HKs&Os5r_5
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 83S5CJT4iI_17
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 AX4yu732A7_8
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 $bdiZgBCdt_1
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 dHdaGFGWQZ_11
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 dOuR&c&zpX_13
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 FsK3eDIaE5_3
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 LNf$VHhY4R_16
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 M9ednHvvHE_18
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 mAjtSBPeVJ_15
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 pOHbjOl4T%_10
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 T5URhJtJq2_2
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 t8lGqps%su_6
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 tnBFG%XjMW_9
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 u2$YAp8y&F_20
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 ukWmw&Pb02_12
-rw-r--r-- 1 ap0calypse users 0 2008-06-03 10:53 zzso!5dtcJ_14
As you can see it creates files with special characters in it. If anyone doesn’t like this, change the source code.