$line_a=0;
$line_b=0;
open(PLAIN, "plain.txt") or die "File does not exist: $!";
while(<PLAIN>){
@my_a[$line_a] = $_;
$line_a++;
}
close PLAIN;
open(COUNTER, "counter") or die "File does not exist: $!";
while(<COUNTER>){
@my_b[$line_b] = $_;
$line_b++;
}
close COUNTER;
$element1 = @my_a;
$element2 = @my_b;
$i = 0;
$j = 0;
while ($element1 > $i) {
if ($element2 <= $j){
$j = 0;
}
@my_c[$i] = @my_a[$i] ^ @my_b[$j];
@my_d[$i] = @my_b[$j] ^ @my_c[$i];
$i++;
$j++;
}
Here the question,
1. How can i open and read the file in byte[] mode?
2. How do we ensure that the @my_d == @my_a[] after we XOr it back? (i've tried it, but it mess up lots of whitespace)
3. Because this is a Crypto-Counter Mode process, do anyone know whats the simplest way of calling them? (rather than recreating these codes above).
Thanx in advance..
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.