Hello, I wrote a simple DES in ECB mode implementation in Perl based on W.Stallings book... When I tried to compare it with online calc. I didnt get exactly the same outputs(lets focus on encryption as the process is idenctical) what do I mean is, we know DES works on blocks of 8 bytes and both my script and online calcs. give the same result for the first 2 blocks only! so I came to the conclusion that I am not reading the input file as 8 byte chunks correctly or as them.... Please help me understand why(again assumption is the read from file func is somehow wrong)??

remarks: -I am a Perl beginner -For those who are interested this is a self project intended to be shown to my class mates if my teacher would allow me. -code may not be optimal or good :(

In advance tnxxx all helpers and advises !

Code

#!/usr/bin/perl

#--------------------------------------------------------------------------------------------- # @Script CLI args@ # 1) action: "e" or "d", as one char string # 2) password: "myDesPass", as a string # 3) input file: "filePath1", as a string, should contain the message to encrypt # 4) output file: "filePath2", as a string, where the encrypted message will be saved #---------------------------------------------------------------------------------------------

for($j=0; $j<$ScheduleOfLeftShifts[$i]; $j++) { # shift left part according to round push(@leftBitsArr, shift(@leftBitsArr)); # shift right part according to round push(@rightBitsArr, shift(@rightBitsArr)); }