my @glyphs; my $plainText = $_[0]; # Pad string to divisible by glyph choice my $padLength; if( length( $plainText ) % 3 ne "0" ) { $padLength = 3 - ( length( $plainText ) % 3 ); } $plainText .= " "x$padLength; print " pad = $padLength , $plainText X\n"; # Convert text to ASCII @asciiCodes = unpack( "c*", $plainText ); for( $j = 0 ; $j <= ( length( $plainText )/3 )-1 ; $j++ ) { my $sum = 0; for( $k = 0 ; $k <= 2 ; $k++ ) { $i = ( $j*3 + $k ); $sum += @asciiCodes[$i] * ( 65536 ** ( 2-$k ) ); } push( @glyphs , $sum ); } return( @glyphs );