Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a SHA256 tutorial #39

Closed
zaccherinij opened this issue May 23, 2023 · 0 comments
Closed

Create a SHA256 tutorial #39

zaccherinij opened this issue May 23, 2023 · 0 comments
Assignees
Labels
💰 Awarded This project is now completed and awarded 🎯 Bounty This bounty is currently open 📁 Concrete library targeted: Concrete 📁 TFHE-rs library targeted: TFHE-rs
Milestone

Comments

@zaccherinij
Copy link
Collaborator

zaccherinij commented May 23, 2023

Winners

See the two winning solutions here and here

Overview

Create a tutorial demonstrating how to develop a homomorphic SHA256 function

Description

Create an FHE program that computes the SHA-256 value over an encrypted input.
Turn it into a tutorial for the documentation, highlighting the process of turning a regular
program into its FHE equivalent. Input text could be fixed-length for Concrete Numpy solution,
while it should be any length for TFHE-rs solution.

Here is a python example of code you could start from:

import hashlib

import concrete.numpy as cnp
import numpy as np

text = (
    b"Lorem ipsum dolor sit amet, consectetur adipiscing elit. "
    b"Curabitur bibendum, urna eu bibendum egestas, neque augue eleifend odio, et sagittis viverra."
)
assert len(text) == 150

hasher = hashlib.sha256()
hasher.update(text)

sample_input = list(text)
expected_output = list(hasher.digest())

def sha256(data):
    # TODO: implement this function
    pass

compiler = cnp.Compiler(sha256, {"data": "encrypted"})
circuit = compiler.compile(
    inputset=[
        np.random.randint(0, 2 ** 8, size=(150,))
        for _ in range(100)
    ],
    configuration=cnp.Configuration(
        enable_unsafe_features=True,
        use_insecure_key_cache=True,
        insecure_key_cache_location=".keys",
    ),
    verbose=True,
)

We expect your PR to comply with the following:

  • For Concrete Numpy:
    • Input size is fixed to 150 bytes
    • Create the app examples/sha256.py
    • Create the tutorial docs/tutorial/sha256.{md,ipynb}
  • For TFHE-rs:
    • Input size is not fixed
    • Create the app tfhe/examples/sha256.rs
    • Create the tutorial tfhe/docs/tutorial/sha256.md

Library targeted

Bounty type

Expert bounty

Reward

Up to €7,500

Related links and references

Submission

Apply directly to this bounty by opening an application here.

Questions?

Do you have a specific question about this bounty? Join the live conversation on the FHE.org discord server here. You can also send us an email at: [email protected]

@zaccherinij zaccherinij added 💰 Awarded This project is now completed and awarded 📁 TFHE-rs library targeted: TFHE-rs 📁 Concrete library targeted: Concrete labels May 23, 2023
@aquint-zama aquint-zama added this to the Season 2 milestone May 23, 2023
@zaccherinij zaccherinij moved this to Awarded Contributions in Zama Bounty and Grant Program Overview Feb 9, 2024
@zaccherinij zaccherinij added the 🎯 Bounty This bounty is currently open label Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💰 Awarded This project is now completed and awarded 🎯 Bounty This bounty is currently open 📁 Concrete library targeted: Concrete 📁 TFHE-rs library targeted: TFHE-rs
Projects
Status: Awarded Contributions
Development

No branches or pull requests

2 participants