Skip to content

Commit

Permalink
use the correct constant in the FNV1a_128_Hash function as defined in…
Browse files Browse the repository at this point in the history
… the specification

TEST=Use a third-party fnv1a-128 implementation to verify the test values.

BUG=


Review URL: https://chromiumcodereview.appspot.com/12340054

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184988 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
[email protected] committed Feb 27, 2013
1 parent 064701f commit 40a2fdf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,4 @@ Matheus Bratfisch <[email protected]>
Horia Olaru <[email protected]>
Horia Olaru <[email protected]>
Opera Software ASA <*@opera.com>
Johannes Rudolph <[email protected]>
8 changes: 4 additions & 4 deletions net/quic/crypto/null_decrypter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ namespace test {
TEST(NullDecrypterTest, Decrypt) {
unsigned char expected[] = {
// fnv hash
0x47, 0x11, 0xea, 0x5f,
0xcf, 0x1d, 0x66, 0x5b,
0xba, 0xf0, 0xbc, 0xfd,
0x88, 0x79, 0xca, 0x37,
0xa0, 0x6f, 0x44, 0x8a,
0x44, 0xf8, 0x18, 0x3b,
0x47, 0x91, 0xb2, 0x13,
0x6b, 0x09, 0xbb, 0xae,
// payload
'g', 'o', 'o', 'd',
'b', 'y', 'e', '!',
Expand Down
8 changes: 4 additions & 4 deletions net/quic/crypto/null_encrypter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ namespace test {
TEST(NullEncrypterTest, Encrypt) {
unsigned char expected[] = {
// fnv hash
0x47, 0x11, 0xea, 0x5f,
0xcf, 0x1d, 0x66, 0x5b,
0xba, 0xf0, 0xbc, 0xfd,
0x88, 0x79, 0xca, 0x37,
0xa0, 0x6f, 0x44, 0x8a,
0x44, 0xf8, 0x18, 0x3b,
0x47, 0x91, 0xb2, 0x13,
0x6b, 0x09, 0xbb, 0xae,
// payload
'g', 'o', 'o', 'd',
'b', 'y', 'e', '!',
Expand Down
7 changes: 4 additions & 3 deletions net/quic/quic_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ size_t QuicUtils::StreamFramePacketOverhead(int num_frames) {
// static
uint128 QuicUtils::FNV1a_128_Hash(const char* data, int len) {
// The following two constants are defined as part of the hash algorithm.
// see http://www.isthe.com/chongo/tech/comp/fnv/
// 309485009821345068724781371
const uint128 kPrime(16777216, 315);
// 14406626329776981559649562966706236762
const uint128 kOffset(GG_UINT64_C(780984778246553632),
GG_UINT64_C(4400696054689967450));
// 144066263297769815596495629667062367629
const uint128 kOffset(GG_UINT64_C(7809847782465536322),
GG_UINT64_C(7113472399480571277));

const uint8* octets = reinterpret_cast<const uint8*>(data);

Expand Down

0 comments on commit 40a2fdf

Please sign in to comment.