marajade
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Introduction The Shift Left `SHL` opcode in the Ethereum Virtual Machine (EVM) performs a bitwise shift left operation on an integer value. This operation is used to shift the bits of an integer to the left by a specified number of positions, effectively multiplying the number by $2^n$ where `n` is the number of positions shifted. This can be particularly useful for various arithmetic operations, encoding, or when dealing with binary data manipulation within smart contracts. The objective of the challenge is to design an algorithm that performs a logical left shift on input encrypted under BGV or BFV. ## Challenge Info 1. **Challenge type:** This challenge is a White Box challenge. Participants are required to submit the project with their source code. 2. **Encryption Scheme:** BGV, BFV. 3. **FHE Library:** [OpenFHE](https://github.com/openfheorg/openfhe-development). 4. **Input Data:** Input data is two values, one is an encrypted value which should be bitwise shifted to the left on number of bits specified in the second input. * Encrypted value $x\in [0,2^{16}-1]$. * Encrypted value $n\in [0,16]$ is a number of shifted bits 5. **Output Data:** The outcome should be an encrypted vector with the response in the first slot. ## Timeline * **April 26, 2024** - Start Date. * **June 30, 2024** - Submission Deadline. * **Jule 15, 2024** - Prize Awarded. ## Parameters of the input **Packing:** Only the first slot of encrypted vector contains the value. ## Requirements of the output **Packing:** The first slot should contain the value `y = SHL(x, n) = x << n` which is equal to $x*2^i$. ## Encoding technique We pack the input value `X` into a ciphertext as a vector with first element equals `X`: | X | 0 | 0 | ... | |---|---|---|---| In the same way we packed `n` into a ciphertext: | n | 0 | 0 | ... | |---|---|---|---| And we expect a result as the first element of a vector | X << n | 0 | 0 | ...| |---|---|---|---| ## Test environment The following libraries/packages will be used for generating test case data and for testing solutions: * OpenFHE: v1.1.5 * OpenFHE-Python: v0.8.6 ## Submission Participants should submit a ZIP archive containing an `app` folder. Inside this folder, there should be a `CMakeLists.txt` file for building the solution. ### OpenFHE If the solution is developed using the OpenFHE library, we expect to have CMake project. The CMakeLists.txt file should be positioned in the project's root directory. Please adhere to the following format when submitting your solution: 1. **File Format:** - Your submission should be contained within a ZIP archive. 2. **Structure of the Archive:** - Inside the ZIP archive, ensure there is a directory titled `app`. - Within the `app` directory, include your either your cpp solution (with `CMakeLists.txt` file and other necessary source files) or python solution (with `app.py` as a main file). ```mermaid graph TD; app_zip[app.zip] --> app_folder[app] app_folder --> CMakeLists[CMakeLists.txt] app_folder --> main.cpp[main.cpp] app_folder --> ...[...] ``` ```mermaid graph TD; app_zip[app.zip] --> app_folder[app] app_folder --> app[app.py] app_folder --> config[config.json] app_folder --> ...[...] ``` ### Config file Users can use config file to set parameters for generating a context on the server for testing the solution. For example, you must specify the encryption scheme, BFV or BGV. ``` { "indexes_for_rotation_key": [1], "mult_depth": 5, "plaintext_modulus": 65537, "max_relin_sk_deg": 5, "scheme": "BFV" } ``` The project must support the Command Line Interface (CLI) specified in the section below. ## Command-Line Interface for Application Testing ### OpenFHE The application should support the following command-line interface (CLI) options: - **--value** [path]: Specifies the path to the file containing encrypted value. - **--shift** [path]: Specifies the path to the file containing number of shifted bits. - **--output** [path]: Specifies the path to the file where the result should be written. - **--cc** [path]: Indicates the path to the Cryptocontext file serialized in **BINARY** form. - **--key_public** [path]: Specifies the path to the Public Key file. - **--key_mult** [path]: Specifies the path to the Evaluation (Multiplication) Key file. - **--key_rot** [path]: Specifies the path to the Rotation Key file. ## Example The executable will be run as follows: ``` ./app --cc cc.bin --key_public pub.bin --key_mult mult.bin --value value.bin --shift shift.bin --output out.bin ``` An example for the message encrypted in `in.bin`: `value = [16, 0, 0, 0, ...]` An example of the message encrypted in `shift.bin`: `shift = [2, 0, 0, 0]` An example output for this input: `Output = [64, 0, 0, 0, ...]` ## Evaluation Criteria Submissions will be evaluated based on the following criteria: 1. **Correctness and accuracy:** The output of the program for valid input (i.e., numbers in the range $[0, 65535]$) **must** be correct. 2. **Execution time:** The running time of the application on the provided input data. That is, the winner will be the fastest application whose output is correct and accurate. ## Scorring & Awards The winner of the challenge will be awarded $2500. ## Useful Links * [Fherma participation guide](https://fherma.io/how_it_works) * [OpenFHE](https://github.com/openfheorg/openfhe-development) * [OpenFHE Python](https://github.com/openfheorg/openfhe-python) ## Help If you have any questions, you can: - Contact us by email: support@fherma.io - Ask a question in our [Discord](https://discord.gg/NfhXwyr9M5). - Open an issue on the [GitHub Repository](). - Use [OpenFHE Discourse](https://openfhe.discourse.group).

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully