Git Product home page Git Product logo

kem_camellia_chacha20's Introduction

OUERTANI Mohamed hichem

Usage

  • Made to work on common Linux (debian, fedora). Will not work on MacOS or Windows.
  • Make sure keygen, encaps and decaps are executable (chmod +x keygen encaps decaps)

Demo

$ ./keygen.py 
> 557538c0131e1bfa5051f99faf4f39c06d631ff11801abe69b16e002001b3844
$ ./encaps.py 557538c0131e1bfa5051f99faf4f39c06d631ff11801abe69b16e002001b3844
> af4384c742e640143152f8592edaf155f37c4f3571ca7f782e630a90d3254c77c8459e4fc0c0afab7a83a2078dcb9f7bc0e183a6b90f0c9f3a95cce5a4bab7f90533294462fd97700fa7c20ed5f9f2aa1d1cff408e0ac1152fee29a04f88febb
> 61a307e9753eef0843209cf9637e29fe
$ ./decaps.py pk.key af4384c742e640143152f8592edaf155f37c4f3571ca7f782e630a90d3254c77c8459e4fc0c0afab7a83a2078dcb9f7bc0e183a6b90f0c9f3a95cce5a4bab7f90533294462fd97700fa7c20ed5f9f2aa1d1cff408e0ac1152fee29a04f88febb
> 61a307e9753eef0843209cf9637e29fe

Requirements

You may use a python virtual environment if you wish. Using bash it may look like so :

  • python -m venv .venv; source .venv/bin/activate; pip install -r requirements.txt
  • ./keygen sk.key
  • ...
  • deactivate

Debug

Set DEBUG=True in lib/deps/KEM.py for debug messages.

Useful Info

Private key format

  • 32 bytes for private key, followed by LS_bytes bytes for the extra randomness, followed by 32 bytes of public key and 32 bytes of public key hash, little endian for everything.

Symmetric encryption protocol

  • ChaCha20 is used here. Evidently, the symmetric encryption algorithm can be swapped with other ones (AES, Camellia, Blowfish, ...). To use Camellia for example, look at the comment in lib/deps/KEM.py. It is less trivial to make an example where the encapsulation is messed with using Camellia (decryption of message can fail to an error), hence ChaCha20 is used here.

  • SHAKE128 is used for all hashes. The size of the output differs each time (32, 64 and 16 bytes)

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.