CARVIEW |
Select Language
HTTP/2 200
date: Wed, 30 Jul 2025 22:56:10 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"a9399a92bfe879e0dfe2a724af28abac"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com wss://alive-staging.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=IinSgO43G8aa0Bz4DZytJwLt8K6ai8V5fVInv%2FaNSEG7sdylNczAjRJkXq1RJn1quFR%2F9ykadeuzVmfNlttK8fdIRDeDVQNn3GLIbjmUyuXss2IdR%2FIt734ro7UzIXSuPRYMWAZDwLvuqL26kOXgIU%2BVtd0ss18%2FAxTOnkFhk8uSeCNoBNLOHvtbZRh4yx17w%2BiABk7WwaDwx%2FmEvWs%2BXSqmUvWSwPaAmj8HkNc8liADUsv1ZkE6VLMryglS1G%2BVpCSJLdbTBpdmLoIFImQ%2BxQ%3D%3D--BEFuPp%2F1DbLYADHa--CPmsqKenAZAPxizOLTwudQ%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.993356177.1753916169; Path=/; Domain=github.com; Expires=Thu, 30 Jul 2026 22:56:09 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Thu, 30 Jul 2026 22:56:09 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: BE52:FA5FC:9ED30:EC799:688AA309
GitHub - catb0t/fnv-hash: Git mirror of the Fowler Noll Vo (FNV) hash algorithm original C source
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 1
Git mirror of the Fowler Noll Vo (FNV) hash algorithm original C source
License
catb0t/fnv-hash
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
#=====================# # Fowler/Noll/Vo hash # #=====================# The basis of this hash algorithm was taken from an idea sent as reviewer comments to the IEEE POSIX P1003.2 committee by: Phong Vo (https://www.research.att.com/info/kpv) Glenn Fowler (https://www.research.att.com/~gsf/) In a subsequent ballot round: Landon Curt Noll (https://www.isthe.com/chongo) improved on their algorithm. Some people tried this hash and found that it worked rather well. In an EMail message to Landon, they named it the ``Fowler/Noll/Vo'' or FNV hash. FNV hashes are designed to be fast while maintaining a low collision rate. The FNV speed allows one to quickly hash lots of data while maintaining a reasonable collision rate. See: https://www.isthe.com/chongo/tech/comp/fnv/index.html for more details as well as other forms of the FNV hash. Comments, questions, bug fixes and suggestions welcome at the address given in the above URL. #==================# # FNV hash utility # #==================# Two hash utilities (32 bit and 64 bit) are provided: fnv032 [-b bcnt] [-m] [-s arg] [-t code] [-v] [arg ...] fnv132 [-b bcnt] [-m] [-s arg] [-t code] [-v] [arg ...] fnv1a32 [-b bcnt] [-m] [-s arg] [-t code] [-v] [arg ...] fnv064 [-b bcnt] [-m] [-s arg] [-t code] [-v] [arg ...] fnv164 [-b bcnt] [-m] [-s arg] [-t code] [-v] [arg ...] fnv1a64 [-b bcnt] [-m] [-s arg] [-t code] [-v] [arg ...] -b bcnt mask off all but the lower bcnt bits (default: 32) -m multiple hashes, one per line for each arg -s hash arg as a string (ignoring terminating NUL bytes) -t code 0 ==> generate test vectors, 1 ==> test FNV hash -v verbose mode, print arg after hash (implies -m) arg string (if -s was given) or filename (default stdin) The fnv032, fnv064 implement the historic FNV-0 hash. The fnv132, fnv164 implement the recommended FNV-1 hash. The fnv1a32, fnv1a64 implement the recommended FNV-1a hash. This is the original historic FNV algorithm with a 0 offset basis. It is recommended that FNV-1, with a non-0 offset basis be used instead. To test FNV hashes, try: fnv032 -t 1 -v fnv132 -t 1 -v fnv1a32 -t 1 -v fnv064 -t 1 -v fnv164 -t 1 -v fnv1a64 -t 1 -v If you are compiling, try: make check #==================# # FNV hash library # #==================# The libfnv.a library implements both a 32 bit and a 64 bit FNV hash on collections of bytes, a NUL terminated strings or on an open file descriptor. Here is the 32 bit FNV 1 hash: Fnv32_t fnv_32_buf(void *buf, int len, Fnv32_t hval); /* byte buf */ Fnv32_t fnv_32_str(char *string, Fnv32_t hval); /* string */ Here is the 32 bit FNV 1a hash: Fnv32_t fnv_32a_buf(void *buf, int len, Fnv32_t hval); /* byte buf */ Fnv32_t fnv_32a_str(char *string, Fnv32_t hval); /* string */ Here is the 64 bit FNV 1 hash: Fnv64_t fnv_64_buf(void *buf, int len, Fnv64_t hval); /* byte buf */ Fnv64_t fnv_64_str(char *string, Fnv64_t hval); /* string */ Here is the 64 bit FNV 1a hash: Fnv64_t fnv_64a_buf(void *buf, int len, Fnv64_t hval); /* byte buf */ Fnv64_t fnv_64a_str(char *string, Fnv64_t hval); /* string */ On the first call to a hash function, one must supply the initial basis that is appropriate for the hash in question: FNV-0: (not recommended) FNV0_32_INIT /* 32 bit FNV-0 initial basis */ FNV0_64_INIT /* 64 bit FNV-0 initial basis */ FNV-1: FNV1_32_INIT /* 32 bit FNV-1 initial basis */ FNV1_64_INIT /* 64 bit FNV-1 initial basis */ FNV-1a: FNV1A_32_INIT /* 32 bit FNV-1a initial basis */ FNV1A_64_INIT /* 64 bit FNV-1a initial basis */ For example to perform a 64 bit FNV-1 hash: #include "fnv.h" Fnv64_t hash_val; hash_val = fnv_64_str("a string", FNV1_64_INIT); hash_val = fnv_64_str("more string", hash_val); produces the same final hash value as: hash_val = fnv_64_str("a stringmore string", FNV1_64_INIT); NOTE: If one used 'FNV0_64_INIT' instead of 'FNV1_64_INIT' one would get the historic FNV-0 hash instead recommended FNV-1 hash. To perform a 32 bit FNV-1 hash: #include "fnv.h" Fnv32_t hash_val; hash_val = fnv_32_buf(buf, length_of_buf, FNV1_32_INIT); hash_val = fnv_32_str("more data", hash_val); To perform a 64 bit FNV-1a hash: #include "fnv.h" Fnv64_t hash_val; hash_val = fnv_64a_buf(buf, length_of_buf, FNV1_64_INIT); hash_val = fnv_64a_str("more data", hash_val); =-= chongo <Landon Curt Noll> /\oo/\ https://www.isthe.com/chongo Share and Enjoy!
About
Git mirror of the Fowler Noll Vo (FNV) hash algorithm original C source
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published
You can’t perform that action at this time.