Fowler–Noll–Vo hash function

Fowler–Noll–Vo (or FNV) is a non-cryptographic hash function created by Glenn Fowler, Landon Curt Noll, and Kiem-Phong Vo.

The basis of the FNV hash algorithm was taken from an idea sent as reviewer comments to the IEEE POSIX P1003.2 committee by Glenn Fowler and Phong Vo in 1991. In a subsequent ballot round, Landon Curt Noll improved on their algorithm. In an email message to Landon, they named it the Fowler/Noll/Vo or FNV hash.[1]

Overview

The current versions are FNV-1 and FNV-1a, which supply a means of creating non-zero FNV offset basis. FNV currently[as of?] comes in 32-, 64-, 128-, 256-, 512-, and 1024-bit variants. For pure FNV implementations, this is determined solely by the availability of FNV primes for the desired bit length; however, the FNV webpage discusses methods of adapting one of the above versions to a smaller length that may or may not be a power of two.[2][3]

The FNV hash algorithms and reference FNV source code[4][5] have been released into the public domain.[6]

The Python programming language previously used a modified version of the FNV scheme for its default hash function. From Python 3.4, FNV has been replaced with SipHash to resist "hash flooding" denial-of-service attacks.[7]

FNV is not a cryptographic hash.[4]

The hash

One of FNV's key advantages is that it is very simple to implement.[8] Start with an initial hash value of FNV offset basis. For each byte in the input, multiply hash by the FNV prime, then XOR it with the byte from the input. The alternate algorithm, FNV-1a, reverses the multiply and XOR steps.

FNV-1 hash

The FNV-1 hash algorithm is as follows:[9][10]

algorithm fnv-1 is
    hash := FNV_offset_basis

    for each byte_of_data to be hashed do
        hash := hash × FNV_prime
        hash := hash XOR byte_of_data

    return hash 

In the above pseudocode, all variables are unsigned integers. All variables, except for byte_of_data, have the same number of bits as the FNV hash. The variable, byte_of_data, is an 8-bit unsigned integer.

As an example, consider the 64-bit FNV-1 hash:

  • All variables, except for byte_of_data, are 64-bit unsigned integers.
  • The variable, byte_of_data, is an 8-bit unsigned integer.
  • The FNV_offset_basis is the 64-bit value: 14695981039346656037 (in hex, 0xcbf29ce484222325).
  • The FNV_prime is the 64-bit value 1099511628211 (in hex, 0x100000001b3).
  • The multiply returns the lower 64 bits of the product.
  • The XOR is an 8-bit operation that modifies only the lower 8-bits of the hash value.
  • The hash value returned is a 64-bit unsigned integer.

FNV-1a hash

The FNV-1a hash differs from the FNV-1 hash only by the order in which the multiply and XOR is performed:[9][11]

algorithm fnv-1a is
    hash := FNV_offset_basis

    for each byte_of_data to be hashed do
        hash := hash XOR byte_of_data
        hash := hash × FNV_prime

    return hash 

The above pseudocode has the same assumptions that were noted for the FNV-1 pseudocode. The change in order leads to slightly better avalanche characteristics.[9][12]

FNV-0 hash (deprecated)

The FNV-0 hash differs from the FNV-1 hash only by the initialisation value of the hash variable:[9][13]

algorithm fnv-0 is
    hash := 0

    for each byte_of_data to be hashed do
        hash := hash × FNV_prime
        hash := hash XOR byte_of_data

    return hash

The above pseudocode has the same assumptions that were noted for the FNV-1 pseudocode.

A consequence of the initialisation of the hash to 0 is that empty messages and all messages consisting of only the byte 0, regardless of their length, hash to 0.[13]

Use of the FNV-0 hash is deprecated except for the computing of the FNV offset basis for use as the FNV-1 and FNV-1a hash parameters.[9][13]

FNV offset basis

There are several different FNV offset bases for various bit lengths. These offset bases are computed by computing the FNV-0 from the following 32 octets when expressed in ASCII:

chongo <Landon Curt Noll> /\../\

This is one of Landon Curt Noll's signature lines. This is the only current practical use for the deprecated FNV-0.[9][13]

FNV prime

An FNV prime is a prime number and is determined as follows:[4][14]

For a given integer s such that 4 < s < 11, let n = 2s and t = (5 + n) / 12; then the n-bit FNV prime is the smallest prime number p that is of the form

such that:

  • 0 < b < 28,
  • the number of one-bits in the binary representation of b is either 4 or 5, and
  • p mod (240 − 224 − 1) > 224 + 28 + 7.

Experimentally, FNV primes matching the above constraints tend to have better dispersion properties. They improve the polynomial feedback characteristic when an FNV prime multiplies an intermediate hash value. As such, the hash values produced are more scattered throughout the n-bit hash space.[4][14]

FNV hash parameters

The above FNV prime constraints and the definition of the FNV offset basis yield the following table of FNV hash parameters:

FNV parameters [4][15]
Size in bits

Representation FNV prime FNV offset basis
32 Expression 224 + 28 + 0x93
Decimal 16777619 2166136261
Hexadecimal 0x01000193 0x811c9dc5
64 Expression 240 + 28 + 0xb3
Decimal 1099511628211 14695981039346656037
Hexadecimal 0x00000100000001b3 0xcbf29ce484222325
128 Representation 288 + 28 + 0x3b
Decimal 309485009821345068724781371 144066263297769815596495629667062367629
Hexadecimal 0x0000000001000000000000000000013b 0x6c62272e07bb014262b821756295c58d
256 Representation 2168 + 28 + 0x63
Decimal

374144419156711147060143317
175368453031918731002211

100029257958052580907070968620625704837
092796014241193945225284501741471925557

Hexadecimal

0x00000000000000000000010000000000
00000000000000000000000000000163

0xdd268dbcaac550362d98c384c4e576ccc8b153
6847b6bbb31023b4c8caee0535

512 Representation 2344 + 28 + 0x57
Decimal

358359158748448673689190764
890951084499463279557543925
583998256154206699388825751
26094039892345713852759

965930312949666949800943540071631046609
041874567263789610837432943446265799458
293219771643844981305189220653980578449
5328239340083876191928701583869517785

Hexadecimal

0x0000000000000000 0000000000000000
0000000001000000 0000000000000000
0000000000000000 0000000000000000
0000000000000000 0000000000000157

0xb86db0b1171f4416 dca1e50f309990ac
ac87d059c9000000 0000000000000d21
e948f68a34c192f6 2ea79bc942dbe7ce
182036415f56e34b ac982aac4afe9fd9

1024 Representation 2680 + 28 + 0x8d
Decimal

501645651011311865543459881103
527895503076534540479074430301
752383111205510814745150915769
222029538271616265187852689524
938529229181652437508374669137
180409427187316048473796672026
0389217684476157468082573

14197795064947621068722070641403218320
88062279544193396087847491461758272325
22967323037177221508640965212023555493
65628174669108571814760471015076148029
75596980407732015769245856300321530495
71501574036444603635505054127112859663
61610267868082893823963790439336411086
884584107735010676915

Hexadecimal

0x0000000000000000 0000000000000000
0000000000000000 0000000000000000
0000000000000000 0000010000000000
0000000000000000 0000000000000000
0000000000000000 0000000000000000
0000000000000000 0000000000000000
0000000000000000 0000000000000000
0000000000000000 000000000000018d

0x0000000000000000 005f7a76758ecc4d
32e56d5a591028b7 4b29fc4223fdada1
6c3bf34eda3674da 9a21d90000000000
0000000000000000 0000000000000000
0000000000000000 0000000000000000
0000000000000000 000000000004c6d7
eb6e73802734510a 555f256cc005ae55
6bde8cc9c6a93b21 aff4b16c71ee90b3

Non-cryptographic hash

The FNV hash was designed for fast hash table and checksum use, not cryptography. The authors have identified the following properties as making the algorithm unsuitable as a cryptographic hash function:[16]

  • Speed of computation – As a hash designed primarily for hashtable and checksum use, FNV-1 and FNV-1a were designed to be fast to compute. However, this same speed makes finding specific hash values (collisions) by brute force faster.
  • Sticky state – Being an iterative hash based primarily on multiplication and XOR, the algorithm is sensitive to the number zero. Specifically, if the hash value were to become zero at any point during calculation, and the next byte hashed were also all zeroes, then the hash would not change. This makes colliding messages trivial to create given a message that results in a hash value of zero at some point in its calculation. Additional operations, such as the addition of a third constant prime on each step, can mitigate this but may have detrimental effects on avalanche effect or random distribution of hash values.
  • Diffusion – The ideal secure hash function is one in which each byte of input has an equally-complex effect on every bit of the hash. In the FNV hash, the ones place (the rightmost bit) is always the XOR of the rightmost bit of every input byte. This can be mitigated by XOR-folding (computing a hash twice the desired length, and then XORing the bits in the "upper half" with the bits in the "lower half").[4]

See also

References

  1. ^ "FNV Hash - FNV hash history". www.isthe.com.
  2. ^ "FNV Hash - Changing the FNV hash size - xor-folding". www.isthe.com.
  3. ^ "FNV Hash - Changing the FNV hash size - non-powers of 2". www.isthe.com.
  4. ^ a b c d e f Eastlake, Donald; Hansen, Tony; Fowler, Glenn; Vo, Kiem-Phong; Noll, Landon (29 May 2019). "The FNV Non-Cryptographic Hash Algorithm". tools.ietf.org.
  5. ^ "FNV Hash - FNV source". www.isthe.com.
  6. ^ FNV put into the public domain on isthe.com
  7. ^ "PEP 456 -- Secure and interchangeable hash algorithm". Python.org.
  8. ^ Smith, James (2022-05-29). "Hash Functions in Go". Golang Project Structure. Retrieved 2024-10-19.
  9. ^ a b c d e f Eastlake, Donald; Hansen, Tony; Fowler, Glenn; Vo, Kiem-Phong; <unknown-email-Landon-Noll>, Landon Noll (June 4, 2020). "The FNV Non-Cryptographic Hash Algorithm". tools.ietf.org. Retrieved 2020-06-04. {{cite journal}}: |last5= has generic name (help)
  10. ^ "FNV Hash - The core of the FNV hash". www.isthe.com. Retrieved 2020-06-04.
  11. ^ "FNV Hash - FNV-1a alternate algorithm". www.isthe.com.
  12. ^ "avalanche - murmurhash". sites.google.com.
  13. ^ a b c d "FNV Hash - FNV-0 Historic not". www.isthe.com.
  14. ^ a b "FNV Hash - A few remarks on FNV primes". www.isthe.com.
  15. ^ "FNV Hash - Parameters of the FNV-1/FNV-1a hash". www.isthe.com.
  16. ^ Eastlake, Donald; Hansen, Tony; Fowler, Glenn; Vo, Kiem-Phong; Noll, Landon (29 May 2019). "The FNV Non-Cryptographic Hash Algorithm". tools.ietf.org. Retrieved 2021-01-12.

Read other articles:

Grumman C-1 Trader adalah varian carrier onboard delivery (COD) sayap tinggi (high wing) Grumman S-2 Tracker. Ia digantikan dengan versi yang sama dari Northrop Grumman E-2 Hawkeye, Grumman C-2 Greyhound. Referensi Pranala luar Media terkait C-1 Trader di Wikimedia Commons lbsPesawat Grumman dan Northrop GrummanTanda perusahaan G-1 (floats only) · G-2 (floats only) · G-3 · G-4 · G-5 · G-6 · G-7 · G-8 · G-...

 

Ancient English office, now largely ceremonial John of Gaunt was the Sheriff of Lancashire in the years 1362–1371. The High Sheriff of Lancashire is an ancient office, now largely ceremonial, granted to Lancashire, a county in North West England.[1] High Shrievalties are the oldest secular titles under the Crown, in England and Wales. The High Sheriff of Lancashire is the representative of the monarch in the county, and is the Keeper of The King's Peace in the county, executing judg...

 

Kualifikasi sepak bola pada Pekan Olahraga Provinsi Sulawesi Selatan 2022Kualifikasi sepak bola pada Provinsi Sulsel 2022Kualifikasi sepak bola pada Porprov Sulsel XVIINegara IndonesiaTanggal penyelenggaraan10 Juli – 25 Agustus 2021Tempat penyelenggaraan Lapangan Andi Djemma, Kabupaten Luwu Lapangan Kodim 1404 Rantepao, Kabupaten Toraja Utara Stadion FIK UNM, Kota Makassar Stadion Gelora B.J. Habibie, Kota Parepare Stadion La Patau, Kabupaten Bone Stadion Merdeka Kassi Kebo, Kabupaten Maros...

Observatoire de la langue françaiseHistoireFondation 2008CadreSiège 19-21 avenue Bosquet 75007 ParisPays FranceOrganisationDirection Louise MushikiwaboPersonnes clés Nivine Khaled, directrice Langue française et diversité des cultures francophonesAlexandre Wolff, responsable de l'ObservatoireFrancine Quéméner, spécialiste de programmeSite web observatoire.francophonie.orgmodifier - modifier le code - modifier Wikidata L'Observatoire de la langue française est un outil de l'Organisati...

 

Paul-Émile BorduasBornNovember 1, 1905 (1905-11)Saint-Hilaire, QuebecDiedFebruary 22, 1960 (1960-02-23) (aged 54)Paris, FranceEducationAteliers d'Art Sacré in ParisKnown forPainterMovementLes Automatistes Paul-Émile Borduas Place Paul-Émile Borduas seen from rue Saint-Denis, ending at the Quèbec National Library and Archives Composition 11, ca 1957. Exhibited Dec. 2011 at the Big Bang exhibition Musée des beaux-arts de Montréal Paul-Émile Borduas (November 1, 1905 ...

 

KocaelisporNama lengkapKocaelispor KulübüJulukanYeşil Şimşekler(Green Lightnings)Berdiri1966StadionStadion Ismet Paşa,İzmit, Turki(Kapasitas: 16,500)KetuaOrhan Görsen[1]ManajerSoner Alp[2]LigaLiga Kedua, Grup Putih2010–11Liga Kedua TFF Grup merah, ke-12 Kostum kandang Kostum tandang Kocaelispor, adaah tim sepak bola dari İzmit, Turkey. Mereka didirikan pada tahun 1966 dan bermain di Liga sepak bola Turki sejak 1980-1988 dan 1992-2003. Hasil terbaik mereka saat berad...

Ovis Mouflon Klasifikasi ilmiah Kerajaan: Animalia Filum: Chordata Kelas: Mamalia Ordo: Artiodactyla Famili: Bovidae Subfamili: Caprinae Genus: OvisLinnaeus,1758 Spesies Lihat teks. Ovis adalah salah satu genus Mamalia yang termasuk ke dalam famili ruminansia Bovidae. Genus ini terdiri dari enam spesies yang sering disebut domba. Anggota paling terkenal dari genus ini adalah domba domestik (Ovis aries). Spesies Ovis ammon Argali Ovis aries aries[1] Domba domestik Ovis aries orientali...

 

The Boy Foretold by the StarsPoster rilis teatrikal FilipinaSutradaraDolly DuluProduserDerick CabridoJodi Sta. Maria[1]Omar SortijasJose Maria MendozaPatricia CoronadoCenon PalomaresPemeran Adrian Lindayag Keann Johnson Iyah Mina Penata musikPietro Marco S. Javier; Jannina Mikaela MinglanillaSinematograferMarvin ReyesPenyuntingNoah TongaPerusahaanproduksiClever Minds Inc.The Dolly CollectionBrainstormers LabTanggal rilis 25 Desember 2020 (2020-12-25)[2] Durasi107 me...

 

FilmNation EntertainmentJenisSwastaIndustriFilmDidirikan2008PendiriGlen Basner, CEOKantorpusat150 West 22nd Street9th FloorNew York City, NY 10011345 North Maple DriveSuite 202Beverly Hills, CA 90210Situs webFilmNation Entertainment FilmNation Entertainment, LLC adalah perusahaan produksi dan distribusi film Amerika Serikat yang didirikan oleh eksekutif film Glen Basner tahun 2008.[1] The company distributes a lot of films around the world.[2] Pada tanggal 6 November 2013, Fil...

AwardSouthern Cross Medal (1952)TypeMilitary decoration for meritAwarded forOutstanding devotion to dutyCountry South AfricaPresented bythe Monarch of the United Kingdom and the Commonwealth realms and, from 1961, the State PresidentEligibilityAll ranks until 1967Officers from 1967Post-nominalsSMStatusDiscontinued in 1975Established1952First awarded1960Ribbon bar PrecedenceNext (higher)SADF precedence: Medical Service Cross SANDF precedence: Medical Service Cross Next (lower)S...

 

Эта статья об отображении поверхности в сферу; об отображении единичного отрезка в себя см. Преобразование Гаусса. Отображение Гаусса ставит в соответствие каждой точке поверхности вектор единичной нормали в этой точке. Концы всех таких векторов, отложенных от одной то�...

 

BrommaplanStasiun Stockholms tunnelbanaKoordinat59°20′18″N 17°56′22″E / 59.33833°N 17.93944°E / 59.33833; 17.93944Koordinat: 59°20′18″N 17°56′22″E / 59.33833°N 17.93944°E / 59.33833; 17.93944PemilikStorstockholms LokaltrafikSejarahDibuka26 Oktober 1952Operasi layanan Stasiun sebelumnya   Stockholms tunnelbana   Stasiun berikutnya Åkeshov Åkeshov, Vällingby atau Hässelby strand Jalur T17Abrahamsberg Skarpnäc...

Town in the state of Maine, United States Town in Maine, United StatesStandish, MaineTownView of Standish c. 1910 SealLocation in Cumberland County and the state of Maine.Coordinates: 43°45′42″N 70°33′52″W / 43.76167°N 70.56444°W / 43.76167; -70.56444CountryUnited StatesStateMaineCountyCumberlandIncorporatedNovember 30, 1785Named forMyles StandishVillagesStandishHarmon BeachRichvilleSebago LakeSteep FallsWards CoveElmwoodArea[...

 

You Carry MePoster filmSutradaraIvona JukaDitulis olehIvona JukaPemeranLana BarićTanggal rilis 3 Mei 2015 (2015-05-03) (Montenegro) 25 Mei 2015 (2015-05-25) (Kroasia) Durasi155 menitNegaraKroasiaSloveniaSerbiaMontenegroBahasaKroasia You Carry Me (Kroasia: Ti mene nosišcode: hr is deprecated ) adalah sebuah film drama kerjasama produksi internasional 2015 yang disutradarai oleh Ivona Juka. Film tersebut terpilih sebagai perwakilan Montenegro untuk Film Berbahasa Asing Terba...

 

Statue by Matthew Cotes Wyatt For other monuments to Wellington, see List of monuments to Arthur Wellesley, 1st Duke of Wellington. Equestrian statue of theDuke of WellingtonThe Wellington Monument, Aldershot, showing the Duke of Wellington, holding a field marshal's baton, seated on his charger CopenhagenArtistMatthew Cotes WyattSubjectArthur Wellesley, 1st Duke of WellingtonDimensions910 cm × 790 cm (30 ft × 26 ft); 22 feet 8 inches ft di...

Shopping mall in Hong Kong, at the junction of Carnarvon and Granville RoadsThe ONEThe ONE shopping centreLocationTsim Sha Tsui, Hong Kong, at the junction of Carnarvon and Granville RoadsAddress100 Nathan Road, Tsim Sha Tsui, Hong KongOpening date29 October 2010; 13 years ago (2010-10-29)DeveloperChinese Estates HoldingsManagementChinese Estates HoldingsNo. of stores and services130Total retail floor area400,000 square feet (37,000 m2)No. of floors23WebsiteThe ONE You...

 

Etihad Airways From Abu Dhabi to the World Un Boeing 787-10 de Etihad Airways en el Aeropuerto de Mánchester. IATAEY OACIETD IndicativoETIHAD Fundación 2003Aeropuerto principal Aeropuerto Internacional de Abu DabiSede central Abu Dabi, Emiratos Árabes UnidosFlota 86[1]​Destinos Over 90 Countries[2]​Alianzas Organización Árabe de Transportistas Aéreos Arabesk Airline Alliance Programa de viajero Etihad recidenceCompañía Etihad Aviation GroupDirector ejecutivo Rodrigo Vivero...

 

هذه المقالة يتيمة إذ تصل إليها مقالات أخرى قليلة جدًا. فضلًا، ساعد بإضافة وصلة إليها في مقالات متعلقة بها. (نوفمبر 2020) بطولة الوزن خفيف الثقيل دبليو دبليو إف createdبطولة الوزن خفيف الثقيل دبليو دبليو إف]]championshipnameبطولة الوزن خفيف الثقيل دبليو دبليو إف]]finalchampبطولة الوزن خفيف ال�...

Serbian Orthodox monastery in Bosnia and Herzegovina Žitomislić MonasteryМанастир ŽitomislićReligionAffiliationSerbian OrthodoxRiteEastern OrthodoxEcclesiastical or organizational statusEparchy of Zahumlje and HerzegovinaPatronAnnunciationYear consecratedbetween 1602/1603 and 1609LocationLocationŽitomislićMunicipalityMostarStateBosnia and HerzegovinaShown within Bosnia and HerzegovinaGeographic coordinates43°12′17″N 17°47′38″E / 43.204628278225144°N 17...

 

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Fire test – news · newspapers · books · scholar · JSTOR (March 2015) (Learn how and when to remove this message) Fire test in Sweden, showing rapid fire spread through burning of cable jackets from one cable tray to another A fire test is a means of determining...