Category: | Cryptography |
Author/Contact Info | Asmo - asmo@mail.be - www.chez.com/xasmox (site in french) |
Description: | This is my first package. It seems to work fine ;) It's some sort of personal encryption algorithm that uses XOR, pack, tr, and some weird key transformations. To use it : require 'asmocript.pl'; AsmoCrypt::acrypt($sentence,$key); to crypt a sentence and AsmoCrypt::adecrypt($sentence,$key); to uncrypt a crypted sentence. I apologize for my bad english ;) Asmo |
package AsmoCrypt; BEGIN { } sub acrypt { $phrase = shift(@_); $key = shift(@_); @cles = split(//, $key); foreach $key2(@cles) { chr($key2); push(@key3, $key2); } $lastkey = join("1", @key3); $phrase = $phrase ^ $lastkey; $phrase2 = pack("u", "$phrase"); $phrase2 =~ tr /0123456789`\;$=&:!<>,@%\'-\"?/asmoeturlzxicndpqhcfg +vwkyj/; $result = $phrase2 ^ $lastkey; print $result; } return 1; sub adecrypt { $phrase = shift(@_); $key = shift(@_);; @cles = split(//, $key); foreach $key2(@cles) { chr($key2); push(@key3, $key2); } $lastkey = join("1", @key3); $phrase2 = $phrase ^ $lastkey; $phrase2 =~ tr /asmoeturlzxicndpqhcfgvwkyj/0123456789`\;$=&:!<>,@%\ +'-\"?/; $phrase3 = unpack("u", "$phrase2"); $result = $phrase3 ^ $lastkey; print $result; } END { } |
Back to
Code Catacombs