in reply to Re: packing into a byte token
in thread packing into a byte token

Need to xor each byte, so
use List::Util qw( reduce ); my $token = pack 'NN', time, $employee_id; $token .= reduce { $a ^ $b } split //, $token;

Use "V" instead of "N" if you need the opposite byte order.

Replies are listed 'Best First'.
Re^3: packing into a byte token
by jwkrahn (Abbot) on Sep 21, 2011 at 02:01 UTC
    Need to xor each byte

    Because?

      That's what the OP asked for.