Crypt-SEED
view release on metacpan or search on metacpan
my $txt = shift;
my $hex;
for(my $i=0; $i<length($txt); $i++) {
$hex .= sprintf("%02X", int(unpack('C', substr($txt,$i,1))));
}
$hex;
}
sub readFile {
my $file = shift;
local @ARGV = ($file);
my @array;
while(<>) {
# print;
chomp;
my($num, $ukey, $text, $rkeyHex, $cipHex) =
( m/^(\d+):UKEY=(.{16})\sTEXT=(.{16})\sRKEY=(\S+)\sCIPH=(\S+)/ );
push @array, [$num, $ukey, $text, $rkeyHex, $cipHex];
}
@array;
}
( run in 0.238 second using v1.01-cache-2.11-cpan-4d50c553e7e )