| 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. | #!/usr/bin/perl
if ($#ARGV<0) {
print "Enter string to encode: ";
$str= <STDIN>; chomp $str;
} else {
$str = "@ARGV[0]";
}
$enc = encode($str); print "Hex Encoded value: 0x$enc\n";
sub encode { #Sub to encode
@subvar= @_;
my $sqlstr = $subvar[0];
@ASCII = unpack("C*", $sqlstr);
foreach $line (@ASCII) {
$encoded = sprintf('%lx',$line);
$encoded_command .= $encoded;
}
return $encoded_command;
}
|