firmware-crc.pl 197 B

1234567891011
  1. #!/usr/bin/env perl
  2. use strict;
  3. my $crc = 0;
  4. my $bytes;
  5. my $buf;
  6. while (($bytes = read(STDIN, $buf, 4)) == 4) {
  7. print $buf;
  8. my $v = unpack("N", $buf);
  9. $crc = $crc ^ $v;
  10. }
  11. print pack("N", $crc);