K
Kelvin
Hi, there:
Following is my code, basically I try to simply XOR a 20MB file line by line
with a key
then save it in a file. I am using the lastest ActivePerl in Win2000.
The error I got is,
The instruction at "0x2808698b" referenced memory at "0x00000004".
The memory couldn't be "written".
Click OK to terminate...
Click CANCEL to debug...
What happened?
Thanks.
#!/usr/bin/perl
use POSIX;
open(FIL, "./line_merged.all");
@page_in = <FIL>;
close(FIL);
$key = "This is my key";
$j = 0;
open(FIL, ">./encrypted.all");
binmode FIL;
foreach $line (@page_in) {
if( $j % 100 == 0 ) {
print "\n\n\nLine $j started here: \n";
print "\n" . $line;
}
$j = $j + 1;
$mult = ceil( length( $line ) / length( $key ) ) + 1;
for( $i = 0; $i < $mult; $i = $i + 1) {
$key = $key . $key;
}
$key = substr($key, 0, length($line));
$line = $key ^ $line ;
# print "\n" . $key;
# print "\n\nAfter Encryption\n" . $line;
print FIL $line;
# $line = $key ^ $line ;
# print "\n\nAfter Decryption\n" . $line;
}
close(FIL);
Following is my code, basically I try to simply XOR a 20MB file line by line
with a key
then save it in a file. I am using the lastest ActivePerl in Win2000.
The error I got is,
The instruction at "0x2808698b" referenced memory at "0x00000004".
The memory couldn't be "written".
Click OK to terminate...
Click CANCEL to debug...
What happened?
Thanks.
#!/usr/bin/perl
use POSIX;
open(FIL, "./line_merged.all");
@page_in = <FIL>;
close(FIL);
$key = "This is my key";
$j = 0;
open(FIL, ">./encrypted.all");
binmode FIL;
foreach $line (@page_in) {
if( $j % 100 == 0 ) {
print "\n\n\nLine $j started here: \n";
print "\n" . $line;
}
$j = $j + 1;
$mult = ceil( length( $line ) / length( $key ) ) + 1;
for( $i = 0; $i < $mult; $i = $i + 1) {
$key = $key . $key;
}
$key = substr($key, 0, length($line));
$line = $key ^ $line ;
# print "\n" . $key;
# print "\n\nAfter Encryption\n" . $line;
print FIL $line;
# $line = $key ^ $line ;
# print "\n\nAfter Decryption\n" . $line;
}
close(FIL);