Git Product home page Git Product logo

noir-toy-hashing-assignment's Introduction

Noir FNV Hashing

The goal of this assignment is to learn the basics of Noir by implementing FNV hashing.

FNV (Fowler-Noll-Vo) hashing is a family of non-cryptographic hash functions that are designed to be fast and efficient while producing a relatively good distribution of hash values.

The FNV hash algorithm operates on a byte sequence and produces a hash value. It starts with an initial value, usually a prime number, and then processes each byte of the input data, updating the hash value using a simple multiplication and XOR operation.

The basic implementation of an FNV algorithm in python is given below:

def fnv_hash(data):
    size = 2**32
    hash_value = 0x811C9DC5
    prime = 0x1000193

    for byte in data:
        product = (hash_value * prime) % size
        hash_value = (product ^ byte)

    return hash_value

The function when given a value of 0x079A6F9C returns the hashed value 0x71233de7. Your goal for this assignment is to implement this in Noir. Use the same values of size, initial value and prime number.

Evaluation

  • Create a fork of this repo

  • Clone the forked repo. You can use the following command after replacing the CLONE_URL with the clone url of your repo

    git clone CLONE_URL
    
  • Go to your forked repo and under Actions make sure that github actions on forked repo are enabled.

  • Make changes to the src/main.nr file. Add your hashing logic to calculate_hash function. The function should take in a value and return its hash.

  • Run Tests

    nargo test
    
  • Push your changes to main branch of your forked repo.

  • Submit your name, email and link to your forked repo here.

Reference

noir-toy-hashing-assignment's People

Contributors

fortysevenlabs avatar shubham-kanodia avatar

Watchers

James Cloos avatar  avatar

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.