Heya, aliusman.
I'm no Perl guru, but I dabble from time to time in the dark arts. Let's see if we can run through this and generate a suitable translation.
And if I happen to get anything wrong, perhaps numberwhun would be wiling to step in and assist... *AHEM*.
Anyway.
- @table = (('A' .. 'Z'), ('a' .. 'z'), ('0' .. '9'), '+', '/', '|');
This line creates a big 'ol table with all the letters and numbers, and a few symbols to boot.
- for ($_ = 0; $_ <= $#table; $_++) {
-
$decode_table[ord($table[$_])] = $_;
-
}
Now we're looping through the table array that we created and generating a new hash called #decode_table (in Perl, hashes start with the '#' character, but you reference individual elements in the hash using '$'). The keys of this table are the ordinal values of @table and the values start with 0 and increase by 1 each time.
This creates a local variable $_ and sets it equal to the first index in the special $_ variable (rough equivalent in PHP is probably $_GET or $_COOKIE).
-
s/./unpack('B6', chr($decode_table[ord($&)] << 2))/eg;
-
pack('B' . (int(length($_) / 8) * 8), $_);
Got no idea here. Perhaps numberwhun could be of some assistance as to the purpose of these lines. *AHEM*