]> www.fi.muni.cz Git - slotcarman.git/blob - digest
Factor out packet parsing into a subclassable module.
[slotcarman.git] / digest
1 #!/usr/bin/perl -w
2
3 use strict;
4 use SCXCRC;
5
6 my @data = (
7         # ocekavam 0x7d
8         pack("C*", 0x55, 0xff, 0xf0, 0xf0, 0xf0, 0xaa, 0xaa, 0xaa),
9
10         # ocekavam 0xb0
11         pack("C*", 0x55, 0xd6, 0x88, 0x88, 0x88, 0x14, 0x50, 0xaa),
12 );
13
14 for my $str (@data) {
15 #       my $c = Digest::CRC->new(type=>'crc8', poly => 0x31, init=>0,
16 #               xorout=>0xbb);
17 #       $c->add($str);
18 #       print $c->hexdigest, "\n";
19         print sprintf("%02x\n", SCXCRC::digest_str($str));
20 }
21