in reply to packing into a byte token
The checksum spec is a little vague. It could be:
my $packed = pack 'NN', time(), 123456789;; my $c = chr(0); $c ^= substr $packed, $_, 1 for 0 .. 7;; $packed .= $c;; print unpack 'C*', $packed;; 78 121 55 23 7 91 205 21 147
Or:
my $packed = pack 'NN', time(), 123456789;; my $c = substr $packed, 0, 1; $c ^= substr $packed, $_, 1 for 1 .. 7;; $packed .= $c;; print unpack 'C*', $packed;; 78 121 66 151 7 91 205 21 102
Probably the latter.
|
|---|