summaryrefslogtreecommitdiffstats
path: root/libkmime/tests/gen_decode_map.pl
blob: 131aef1e76c7d46c55b529f98f328cc05effe53d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl -w

use strict;

my @encodingMap = ( 'A' .. 'Z', 'a' .. 'z', '0' .. '9', '+', '/' );
my @decodingMap = (64) x 128;

my $len = scalar @encodingMap;
for ( my $i = 0 ; $i < $len ; $i++ ) {
    my $value = ord $encodingMap[$i];
    $decodingMap[$value] = $i;
}

for ( my $i = 0 ; $i < 128 ; $i += 16 ) {
    print "  ", join( ", ", @decodingMap[$i..($i+7)] ), ",  ",
                join( ", ", @decodingMap[($i+8)..($i+15)] ), ",\n";
}