in reply to how to encrypt a string...

Hi, Thanks for responding. I found a way to encrypt the string. The encryption may be easily guessed or cracked but it does make it harder for people to read what the string is, which is my intention.
my $Sentence = "Answer to puzzle\n"; print "$Sentence\n"; my $Hex = unpack("H*",$Sentence); print "$Hex\n"; # prints '416e7377657220746f2070757a7a6c650a' my $Sentence2 = pack("H*",$Hex); print "$Sentence2\n"; # prints 'Answer to puzzle'
cheers, kiat

Replies are listed 'Best First'.
Re: Re: how to encrypt a string...
by tachyon (Chancellor) on Dec 22, 2001 at 19:51 UTC

    How about the old bleach invisible encoding like this:

    my $string = "foobar"; my $enc = unpack 'b*', $string; $enc =~ tr/01/ \011/; print "This is \$enc '$enc'\n"; $enc =~ tr/ \011/01/; print "Now this is \$enc '", (pack 'b*', $enc) , "'\n";

    This is really hard to *see* let alone read - I'd call that a hidden field :-)

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print