common has asked for the wisdom of the Perl Monks concerning the following question:
lets say i put 'blah' in log.log with a key of 'mo' i get: ð@R`óÎÞèDÓ³83WPõgç×¥^DPÄ“°CCô" which seems fine but when i decrypt it:sub encrypt { print "enter key: "; $key=<>; $file->open("+>log.log") or die "$!"; $data = $file; $c_txt = rijndael_encrypt($key, MODE_CBC, $data, 256, 128); $file->print($c_txt);}
i get: Ü¥¢Ãs´÷µ|˜+Ûûˆ<g what i'm thinking is that it's the dos line feeds but i don't know how to get rid of them i tried:sub decrypt { print "enter key: "; $key=<>; $file->open("+>log.log") or die "$!"; $c_txt = $file; $p_txt = rijndael_decrypt($key, MODE_CBC, $c_txt, 256, 128); $file->print($p_txt);}
but that doesn't work, so basically what i'm asking is how to get it to read and write correctly. any ideas? thanks.$file =~ s/\r$//; and $file =~ s/\n$//;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: incorrect en/decryption when reading from file
by fokat (Deacon) on Jul 26, 2002 at 01:54 UTC | |
|
Re: incorrect en/decryption when reading from file
by common (Acolyte) on Jul 26, 2002 at 02:31 UTC | |
|
Re: incorrect en/decryption when reading from file
by gmpassos (Priest) on Jul 26, 2002 at 06:46 UTC |