Skip to content

Commit

Permalink
Use crc32b instead of crc32 (#468)
Browse files Browse the repository at this point in the history
* Use crc32b instead of crc32

* Update test to crc32b
  • Loading branch information
marzvrover authored Aug 30, 2023
1 parent 6bd2cc3 commit a24affa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/HasApiTokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function createToken(string $name, array $abilities = ['*'], DateTimeInte
'%s%s%s',
config('sanctum.token_prefix', ''),
$tokenEntropy = Str::random(40),
hash('CRC32', $tokenEntropy)
hash('crc32b', $tokenEntropy)
);

$token = $this->tokens()->create([
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/HasApiTokensTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function test_token_checksum_is_valid()
$tokenEntropy = substr(end($splitToken), 0, -8);

$this->assertEquals(
hash('CRC32', $tokenEntropy),
hash('crc32b', $tokenEntropy),
substr($token, -8)
);
}
Expand Down

0 comments on commit a24affa

Please sign in to comment.