summaryrefslogtreecommitdiffstats
path: root/libkmime/tests/gen_decode_map.pl
diff options
context:
space:
mode:
Diffstat (limited to 'libkmime/tests/gen_decode_map.pl')
-rwxr-xr-xlibkmime/tests/gen_decode_map.pl17
1 files changed, 17 insertions, 0 deletions
diff --git a/libkmime/tests/gen_decode_map.pl b/libkmime/tests/gen_decode_map.pl
new file mode 100755
index 000000000..131aef1e7
--- /dev/null
+++ b/libkmime/tests/gen_decode_map.pl
@@ -0,0 +1,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";
+}