in reply to DES in Perl
Caveat: I know next to nothing about the DES algorithm so am not going to comment on it here.
so I came to the conclusion that I am not reading the input file as 8 byte chunks correctly or as them
Ordinarily, that would mean you would just look at the readInputToArray() subroutine. However, the lack of strict and the profusion of global variables (such as $bytes and @FileArray) is going to make the debugging very difficult. Please do yourself a massive favour and limit the scope of your variables and make your subroutines as self-contained as possible. eg. have readInputToArray() return @FileArray so that the subroutine can be tested in isolation.
All that said, this line is concerning me:
my $padding = "0" x $diff;
Unfamiliar as I am with DES, this shows that you are padding the read string with "0"s - that is a string with each character being ASCII character "0" (dec 48 or hex 0x30) when what I can only guess you actually want is dec 0 or hex 0x00 which is the ASCII NUL. Is this a/the flaw? You tell me :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: DES in Perl
by TomY (Initiate) on Nov 14, 2017 at 10:14 UTC | |
by TomY (Initiate) on Nov 14, 2017 at 10:20 UTC |