Giter VIP home page Giter VIP logo

fnvhash.jl's Introduction

FNVHash

Build Status

Implementations of the Fowler–Noll–Vo hash functions. See Wikipedia for details.

Usage

Two variants are implemented, fnv1() and fnv1a(), the latter is preferred for slightly better avalance characteristics

Hashing strings

s = "string to hash"
fnv1a(UInt32, s)  # 0xf474bad3
fnv1a(UInt64, s)  # 0xff0f01f28783a2d3
fnv1a(UInt128, s) # 0xe676f50e87fe52607a2c13a4c192bca3

Hashing byte vectors

data = [0x0, 0x1, 0x2, 0x3]
fnv1a(UInt32, data)  # 0xc3aa51b1
fnv1a(UInt64, data)  # 0x4475327f98e05411
fnv1a(UInt128, data) # 0x66ad33ec62757277b806e89d2ca0ff79

Hashing raw data

data = [0x0, 0x1, 0x2, 0x3]
GC.@preserve data begin
    raw = pointer(data)
    raw_len = sizeof(data)
    fnv1a(UInt32, raw, raw_len)  # 0xc3aa51b1
    fnv1a(UInt64, raw, raw_len)  # 0x4475327f98e05411
    fnv1a(UInt128, raw, raw_len) # 0x66ad33ec62757277b806e89d2ca0ff79
end

fnvhash.jl's People

Contributors

ancapdev avatar

Watchers

 avatar  avatar  avatar

fnvhash.jl's Issues

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.