use Session::Token;

## The point of this test is to ensure that we are correctly using the
## ISAAC algorithm by comparing our output to Jenkins' null seeded
## test vector published on his website.

use strict;

use Test::More tests => 2;


my $tokenctx = Session::Token->new(
                 alphabet => [ map { chr } (0 .. 255) ],
                 length => 4,
                 seed => "\x00" x 1024, ## null seed
               );
ok($tokenctx, "created context");

my $output = '';

for (0..1) {
  for my $j (0 .. 255) {
    my $v = $tokenctx->get;
    $v = reverse $v;
    $output .= unpack('H*', $v);
    $output .= "\n" if ($j & 7) == 7;
  }
}

my $reference_output;

{
  local $/;
  $reference_output = <DATA>;
}

is($output, $reference_output, "reference output matches");



## This is reference null seeded output from http://www.burtleburtle.net/bob/rand/randvect.txt
__DATA__
[encoded data, 4160 characters]
