Giter Site home page Giter Site logo

jjchidguez / sibc Goto Github PK

View Code? Open in Web Editor NEW
45.0 4.0 10.0 812 KB

Supersingular Isogeny-Based Cryptography constructions (python-code library)

License: GNU General Public License v3.0

Shell 1.67% Python 98.33%
csidh isogenies bsidh sibc isogeny-based velu-formulas cryptography python sidh sike

sibc's Introduction

Supersingular Isogeny-Based Cryptographic constructions

This repository includes a python-code library named sibc, which allows a user-friendly interface to deal with some isogeny-based cryptographic primitive.

The current version of the sibc library has integrated SIDH, CSIDH, and B-SIDH schemes using traditional and velusqrt formulae on Montgomery curve x-only projective coordinates; in particular, sibc allows working with prime and quadratic field classes that permit operating field elements as integers. Additionally, the cryptographic primitives are implemented in constant-time concerning the number of field operations, where a constant-time procedure refers to its running time does not depend on the input or it possibly does from randomness as CSIDH does.

It is worthing to mention, the library is constantly extended, and some signature schemes will be integrated into the sibc library.

The sibc library aims to allow isogeny-contributors for building new primitives with a constant-time nature.

⚠️ There is a new devastating attack against SIDH and SIKE by Castryck & Decru. Currently, there are two public implementations of the Castryck-Decru attack:

  1. Magma code from Castryck-Decru preprint, and
  2. Sagemath code translation from the Magma code, by Giacomo Pope.

⚠️ The attack does extend to B-SIDH and B-SIKE.

❗ The attack does not apply to CSIDH.

Installation

Install the sibc module which provides the sibc program:

sudo python3 setup.py install

For development:

For this installation method, any further modification in sibc directory will be reflect when running sibc library.

# Installing required package
# Before running the following commands, ensure you have the lastest version of pip
pip3 install dh click numpy progress matplotlib networkx stdeb setuptools-scm setuptools

# only pip3 install cpuinfo is missing for macOS (to be fixed in coming versions)
pip3 install pytest pytest-xdist

# Installing the library
sudo pip3 install -e .

Debian package build

To build a package for Debian or Ubuntu, we suggest the use of stdeb:

sudo apt install -y dh-python python3-click python3-progress\
  python3-numpy python3-matplotlib python3-networkx \
  python3-stdeb python3-setuptools-scm python3-setuptools python3-cpuinfo
python3 setup.py bdist_deb
sudo dpkg -i deb_dist/python3-sibc_0.0.1-1_all.deb

Usage

The syntax compilation can be viewed by running one of the following three commands:

# Corresponding with the key-exchange protocol
sibc --help

# Corresponding with benchmarking (only for CSIDH, which has a variable
# running-time cost independent from the key)
sibc csidh-bench

# Corresponding with the costs of KPs (Kernel Point computation), xISOG
# (isogeny construction), and xEVAL (isogeny evaluation)
sibc csidh-test

Usage for the sibc tool:

Usage: sibc [OPTIONS] COMMAND [ARGS]...

    ,-~~-.___.          
   / |  '     \        
  (  )         0        
   \_/-, ,----'         
      ====           // 
     /  \-'~;    /~~~(O)
    /  __/~|   /       |
  =(  _____| (_________|

Options:
  -p, --prime [p434|p503|p610|p751|p253|p255|p247|p237|p257|p512|p1024|p1792|p2048|p4096|p5120|p6144|p8192|p9216]
                                  [default: p512]
  -f, --formula [tvelu|svelu|hvelu]
                                  [default: hvelu]
  -a, --algorithm [sidh|sike|csidh|bsidh|bsike]
                                  [default: csidh]
  -s, --style [wd1|wd2|df]        [default: df]
  -e, --exponent [1|2|3|4|5|6|7|8|9|10]
                                  [default: 10]
  -m, --multievaluation           [default: False]
  -c, --curvemodel [edwards|montgomery]
                                  [default: montgomery]
  -b, --benchmark INTEGER         [default: 128]
  -t, --tuned                     [default: False]
  -u, --uninitialized             [default: False]
  -v, --verbose                   Not the kind of verbosity you might expect
                                  [default: False]
  --version                       Show the version and exit.
  --help                          Show this message and exit.

Commands:
  bsidh-main                   Random instance example of a key-exchange
  bsidh-precompute-parameters  Precomputation of tuned velusqrt parameters
  bsidh-precompute-strategy    Precomputation of optimal strategies
  bsidh-test                   GF(p²)-operation cost of kps, xisog, and...
  csidh-bench                  Average GF(p)-operation cost of a GAE
  csidh-bounds                 Greedy-based search of optimal exponents
  csidh-dh                     Derive shared secret key from CSIDH sk,...
  csidh-genkey                 Generate random CSIDH secret key
  csidh-header                 Optimal strategies as C-code headers files
  csidh-ijk                    Velusqrt parameters as C-code headers files
  csidh-main                   Random instance example of a key-exchange
  csidh-precompute-parameters  Precomputation of tuned velusqrt parameters
  csidh-precompute-strategy    Precomputation of optimal strategies
  csidh-pubkey                 Derive CSIDH public key from CSIDH secret key
  csidh-sdacs                  SDACs as C-code headers files
  csidh-test                   GF(p)-operation cost of kps, xisog, and xeval
  decaps                       (B)SIKE decapsulation
  encaps                       (B)SIKE encapsulation
  keygen                       Generate random (B)SIKE secret and public...
  plot-strategy                draw strategy graphs as a subgraph...
  print-timing
  sidh-precompute-strategy     Precomputation of optimal strategies

SIDH cryptographic API

CSIDH, BSIDH, SIDH, SIKE, and BSIKE objects are available from the sibc package and module.

Automatically generated documentation is available with pydoc after sibc is installed:

pydoc3 sibc.csidh
pydoc3 sibc.bsidh
pydoc3 sibc.sidh

Command Line Interface: examples

# CSIDH
sk_a="$(sibc csidh-genkey)"
pk_a="$(echo "$sk_a"|sibc csidh-pubkey -)"
sk_b="$(sibc csidh-genkey)"
pk_b="$(echo "$sk_b"|sibc csidh-pubkey -)"
ss_a="$(echo "$sk_a"|sibc csidh-dh - "$pk_b")"
ss_b="$(echo "$sk_b"|sibc csidh-dh - "$pk_a")"
echo $ss_a
echo $ss_b

# SIKE
sk="$(sibc -a sidh -p p434 keygen)"
pk3=`echo "${sk}" | tail -n1`
ck="$(echo "$pk3"|sibc -a sidh -p p434 encaps -)"
c0=`echo "${ck}" | head -1`
c1=`echo "${ck}" | tail -2 | head -1`
K=`echo "${ck}" | tail -n1`
K_="$(echo "$sk"|sibc -a sidh -p p434 decaps - "$c0 $c1")"
echo $K
echo $K_

# BSIKE
sk="$(sibc -a bsidh -p p253 keygen)"
pk3=`echo "${sk}" | tail -n1`
ck="$(echo "$pk3"|sibc -a bsidh -p p253 encaps -)"
c0=`echo "${ck}" | head -1`
c1=`echo "${ck}" | tail -2 | head -1`
K=`echo "${ck}" | tail -n1`
K_="$(echo "$sk"|sibc -a bsidh -p p253 decaps - "$c0 $c1")"
echo $K
echo $K_

Basic shared secret generation example with CSIDH

from sibc.csidh import CSIDH, default_parameters
csidh = CSIDH(**default_parameters)

# alice generates a key
alice_secret_key = csidh.secret_key()
alice_public_key = csidh.public_key(alice_secret_key)

# bob generates a key
bob_secret_key = csidh.secret_key()
bob_public_key = csidh.public_key(bob_secret_key)

# if either alice or bob use their secret key with the other's respective
# public key, the resulting shared secrets are the same
shared_secret_alice = csidh.dh(alice_secret_key, bob_public_key)
shared_secret_bob = csidh.dh(bob_secret_key, alice_public_key)

# Alice and bob produce an identical shared secret
assert shared_secret_alice == shared_secret_bob

Basic shared secret generation example with BSIDH

from sibc.bsidh import BSIDH, default_parameters
bsidh = BSIDH(**default_parameters)
sk_a, pk_a = bsidh.keygen_a()
sk_b, pk_b = bsidh.keygen_b()
ss_a, ss_b = bsidh.derive_a(sk_a, pk_b), bsidh.derive_b(sk_b, pk_a)
ss_a == ss_b

Basic example with BSIKE (BSIDH + key encapsulation)

from sibc.bsidh import BSIKE, default_parameters
bsike = BSIKE(**default_parameters)
s, sk3, pk3 = bsike.KeyGen()
c, K = bsike.Encaps(pk3)
K_ = bsike.Decaps((s, sk3, pk3), c)
K == K_

bsike255 = BSIKE('montgomery', 'p255', 'hvelu', True, False, False, False)
s, sk3, pk3 = bsike255.KeyGen()
c, K = bsike255.Encaps(pk3)
K_ = bsike255.Decaps((s, sk3, pk3), c)
K == K_

Basic shared secret generation example with SIDH

from sibc.sidh import SIDH, default_parameters
sidh = SIDH(**default_parameters)
sk_a, pk_a = sidh.keygen_a()
sk_b, pk_b = sidh.keygen_b()
ss_a, ss_b = sidh.dh_a(sk_a, pk_b), sidh.dh_b(sk_b, pk_a)
ss_a == ss_b

Basic example with SIKE (SIDH + key encapsulation)

from sibc.sidh import SIKE, default_parameters
sike = SIKE(**default_parameters)
s, sk3, pk3 = sike.KeyGen()
c, K = sike.Encaps(pk3)
K_ = sike.Decaps((s, sk3, pk3), c)
K == K_

sike503 = SIKE('montgomery', 'p503', False, False)
s, sk3, pk3 = sike503.KeyGen()
c, K = sike503.Encaps(pk3)
K_ = sike503.Decaps((s, sk3, pk3), c)
K == K_

Adding new primes

The field characteristic p should be stored in directory data/sop/, and CSIDH and BSIDH have different structures (see below):

# CSIDH format (here p = cofactor * l_1 * .... l_n - 1)
cofactor l_1 l_2 ... l_n

# BSIDH format
Hexadecimal representation of the prime p
4 l_1 l_2 ... l_n
c e_1 e_2 ... e_n
l'_1 l'_2 ... l'_m
e'_1 e'_2 ... e'_m

# SIDH format: p = 2^{e_2} * 3^{e_3} - 1
e_2 e_3

For the case of BSIDH, M := (4^c * l_1^{e_1} * l_2^{e_2} * ... * l_n^{e_n}) must divide (p + 1), and N := (l'_1^{e'_1} * l'_2^{e'_2} * ... * l'_n^{e'_n}) must divide (p-1). Additionally, the order-M generators PA, QA and PQA := PA - QA should be stored in directory gen/ as projective x-coordinate points. Similarly, the order-N generators PB, QB and PQB := PB - QB also should be stored it the same directory. Both 3-tuples of points must be stored in a single file with the following syntax:

Re(x(PA)) Im(x(PA)) Re(x(QA)) Im(x(QA)) Re(x(PQA)) Im(x(PQA))
Re(x(PB)) Im(x(PB)) Re(x(QB)) Im(x(QB)) Re(x(PQB)) Im(x(PQB))

where Re(X) and Im(X) denote the real and imaginary parts of X with respect to F_p[i]/(i^2 + 1), respectively. Moreover, all the above twelve integers should be stored in hexadecimal.

For SIDH, generators have order either M=2^{e_2} or N=3^{e_3}.

Examples

We summarize some examples of runs of the sibc tool as follows:

# CSIDH
# A single random intances of a key exchange
sibc -p p512 -f hvelu -a csidh -s df -e 10 csidh-main
sibc -p p512 -f hvelu -a csidh -s df -e 10 -m csidh-main
sibc -p p512 -f hvelu -a csidh -s df -e 10 -t csidh-main
sibc -p p512 -f hvelu -a csidh -s df -e 10 -m -t csidh-main
# Average GF(p)-operation cost of 64 random instances
sibc -p p512 -f hvelu -a csidh -s df -m -e 10 -b 64 csidh-bench
sibc -p p512 -f hvelu -a csidh -s df -m -e 10 -b 64 -m csidh-bench
sibc -p p512 -f hvelu -a csidh -s df -m -e 10 -b 64 -t csidh-bench
sibc -p p512 -f hvelu -a csidh -s df -m -e 10 -b 64 -t -m csidh-bench
# GF(p)-operation cost of kps, xisog, and xeval blocks
sibc -p p512 -f hvelu -a csidh csidh-test
sibc -p p512 -f hvelu -a csidh -m csidh-test
sibc -p p512 -f hvelu -a csidh -t csidh-test
sibc -p p512 -f hvelu -a csidh -t -m csidh-test

# BSIDH
# A single random intances of a key exchange
sibc -p p253 -f hvelu -a bsidh bsidh-main
sibc -p p253 -f hvelu -a bsidh -m bsidh-main
sibc -p p253 -f hvelu -a bsidh -t bsidh-main
sibc -p p253 -f hvelu -a bsidh -t -m bsidh-main
# GF(p²)-operation cost of kps, xisog, and xeval blocks
sibc -p p253 -f tvelu -a bsidh bsidh-test
sibc -p p253 -f svelu -a bsidh bsidh-test
sibc -p p253 -f hvelu -a bsidh -t bsidh-test

Remark, our implementation allows us to plot each optimal strategy required (only tested in Linux machines):

# CSIDH
sibc -p p512 -f tvelu -a csidh -s df -e 10 plot-strategy
sibc -p p512 -f svelu -a csidh -s wd1 -e 10 plot-strategy
sibc -p p512 -f hvelu -a csidh -s wd2 -e 5 plot-strategy

# BSIDH
sibc -p p253 -f hvelu -a bsidh plot-strategy
sibc -p p253 -f hvelu -a bsidh -m plot-strategy
sibc -p p253 -f hvelu -a bsidh -t -m plot-strategy

# SIDH
sibc -p p434 -a sidh plot-strategy
sibc -p p503 -a sidh plot-strategy
sibc -p p610 -a sidh plot-strategy
sibc -p p751 -a sidh plot-strategy

Additionally, one can created files with extension .h that includes all the required variables in a the sdacs, strategies, and velusqrt (at least for CSIDH implementations).

# Suitable bounds search with e = 10.
sibc -a csidh -p p512 -s df -f hvelu -e 10 -u csidh-bounds # The greedy-based algorithm on a large searching space, it could take hours or even days!: option -u is required
# SDACs (options -s and -e do not affect the output)
sibc -p p512 -f hvelu -a csidh -s df -e 10 csidh-sdacs
# Optimal sizes of I, J, and K required in velusqrt (options -s and -e do not affect the output)
sibc -p p512 -f hvelu -a csidh -s df -e 10 -t csidh-ijk  # option -t is required
# Optimal strategies
sibc -p p512 -f hvelu -a csidh -s df -e 10 -t csidh-header

BSIDH primes

Currently only p253, p255, p247, p237, and p257 are implemented and tested in the current API. Extending this to other primes is straight-forward.

SIDH primes

Currently only p434, p503, p610, and p751 are implemented and tested in the current API. Extending this to other primes is straight-forward.

Precomputing data for a new prime instances

Generating new data can be easily done by adding and running to either misc/create-csidh-data.sh or misc/create-bsidh-data.sh. The new prime number description should b stored as previously mentioned.

bash misc/create-csidh-data.sh
bash misc/create-bsidh-data.sh

Also, you can do it manually by doing something as follows:

# CSIDH
sibc-precompute-sdacs -p p512 -a csidh # SDACs
sibc -p p512 -f hvelu -a csidh -m -t -u csidh-precompute-parameters # Tuned velusqrt parameters
sibc -p p512 -f hvelu -a csidh -s df -m -u csidh-precompute-strategy # Strategies
# BSIDH
sibc-precompute-sdacs -p p253 -a bsidh # SDACs
sudo sibc -p p253 -f svelu -a bsidh -u bsidh-precompute-parameters # Tuned velusqrt parameters: the option -u is required
sudo sibc -p p253 -f svelu -a bsidh -u bsidh-precompute-strategy # Strategies
# SIDH
sibc -p p434 -a sidh -u sidh-precompute-strategy # Strategies
sibc -p p503 -a sidh -u sidh-precompute-strategy # Strategies
sibc -p p610 -a sidh -u sidh-precompute-strategy # Strategies
sibc -p p751 -a sidh -u sidh-precompute-strategy # Strategies

Furthermore, you can create tests by running bash misc/create-tests.sh and bash misc/test-cli.sh (only CSIDH, BSIKE, and SIKE are handled by now).

If either a new prime instace or primitive is included, then you should add it to misc directory. New primitives require new bash scripts. SIDH instances are simple, only one configuration (for now), and thus you can omit adding them in misc directory.

Remarks

The primes labeled as p253, p255, p247, and p237 correspond with the examples 2, 3, 5, and 6 from B-SIDH paper, respectively. In particular, p257 denotes the prime number given in velusqrt paper. The field airthmetic is centered on primes p = 3 mod 4. Multiplying and squaring in GF(p²) = GF(p)[u]/(u^2 + 1) have a cost of 3 and 2 multiplications in GF(p), respectively.

The current implementation does not have implemented the B-SIDH key validation, it will be included in the next library version.

Adding new prime instances

When adding a new isogeny-based instances (the prime number, and public parameters) should be included in parameter list of sibc/__main__.py (click option -p, --prime) by modifying sibc/constants.py (updating the lists/dictionary [csidh/bsidh]_primes). If a new primitive is included, then you need to update sibc/__main__.py by extending the click options -p (--prime) and -a (--algorithm), and also to include its branch in sibc/montgomery/curve.py and sibc/montgomery/isogeny.py files.

Changes

Significant changes are listed in the CHANGELOG file. Future integrations/modifications are listed in the TODOLIST file.

Authors

  1. Gora Adj [email protected], [email protected];
  2. Jesús-Javier Chi-Domínguez [email protected], [email protected]; and
  3. Francisco Rodríguez-Henríquez [email protected].

Main cryptographer contributors (collaborators):

  1. Jorge Chávez-Saab [email protected], [email protected]

Logo creator contributor

  1. Fabiola-Argentina Hernández-Torres [email protected]

User-friendly interface contributors

  1. Jacob Appelbaum [email protected]; and
  2. Leif Ryge [email protected].

All contributors are listed in the CONTRIBUTORS file.

How to cite this library

@misc{sibc,
  author = {{Gora Adj} and {Jes\'us-Javier Chi-Dom\'inguez} and {Francisco Rodr\'iguez-Henr\'iquez}},
  title = {{SIBC} Python library},
  year = {2021},
  howpublished = {\url{https://github.com/JJChiDguez/sibc/}}
}

License

This project is licensed under the GNU general public license - see the LICENSE file for details.

Funding

This project has initially received funding from the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme (grant agreement No 804476), while the second author was doing a postdoctoral research stay in Tampere University.

The third author received partial funds from the Mexican Science council CONACyT project 313572.

sibc's People

Contributors

calesanz avatar ioerror avatar jchavezsaab avatar jjchidguez avatar leif avatar thomwiggers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sibc's Issues

Release Tag Signing for Packaging

Would it be possible to sign the tags of the releases?

I am currently packaging sibc for the arch user repository (python-sibc-git), because it is used in an other project.

Having signed tags/releases would allow users to have more confidence in the autenticity of the package.

Also it would be very helpful if you could create a new release with the MANIFEST.in from #9 .

Thanks

Compatibility with cloudflare/circl

Hi,

First of all thank you very much for this awesome library!

Im currently working on a Go project which has to work with SCIDH keys generated by this library.
I'd like to use cloudflare/circl for the Go part, but I couldn't get them to work yet.

Do you know if these libraries are even compatible at all? Or maybe you can point me in the right direction.

I've tried the following:

package main

import (
	"crypto/rand"
	"encoding/base64"
	"fmt"

	"github.com/cloudflare/circl/dh/csidh"
)

var rng = rand.Reader

func main() {
	var privateKey csidh.PrivateKey
	var publicKey csidh.PublicKey

	if err := csidh.GeneratePrivateKey(&privateKey, rng); err != nil {
		panic(err)
	}

	csidh.GeneratePublicKey(&publicKey, &privateKey, rng)

	var privateOut [37]byte

	if ok := privateKey.Export(privateOut[:]); !ok {
		panic("failed to export")
	}

	fmt.Printf("privateKeyA: %s\n", base64.StdEncoding.EncodeToString(privateOut[:]))

	var publicOut [64]byte

	if ok := publicKey.Export(publicOut[:]); !ok {
		panic("failed to export")
	}

	fmt.Printf("publicKeyA: %s\n", base64.StdEncoding.EncodeToString(publicOut[:]))
}

and then tried to generate a public key from the printed private key. But that failed:

echo "LiTrMfNR3E4iHSTFEiu8I+ETtBVV7z79Ub+0vk/QsERcvu0kuw=="|sibc csidh-pubkey -
Traceback (most recent call last):
  File "/usr/local/bin/sibc", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1668, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/sibc/__main__.py", line 153, in csidh_pubkey
    click.echo(b64encode(algo.public_key(b64decode(secret_key.read()))))
  File "/usr/local/lib/python3.9/site-packages/sibc/csidh/__init__.py", line 133, in public_key
    xy = self.gae.GAE_at_0(sk)
  File "/usr/local/lib/python3.9/site-packages/sibc/csidh/gae_df.py", line 58, in GAE_at_0
    return self.GAE(
  File "/usr/local/lib/python3.9/site-packages/sibc/csidh/gae_df.py", line 626, in GAE
    E_k, m, e = self.evaluate_strategy(
  File "/usr/local/lib/python3.9/site-packages/sibc/csidh/gae_df.py", line 277, in evaluate_strategy
    s_i = sign(e[pos])  # Sign of e[pos]
IndexError: tuple index out of range

Thanks a lot in advance. :)

EDIT: I've also tried other test cases but they all seem to fail. Maybe I have to adjust some parameters for this to work?

Maybe wrong output of CSIDH's group action with style df and wd1

Hi,

First of all, thank you for your library. I'm trying to implement my CTIDH and reuse a lot of code from your library.

I ran the CSIDH-1024 protocol three times with a fixed Alice's private key and styles of df, wd1, wd2 respectively. The output public keys were different. I think this is weird.

Here are my steps. First I modified the file sibc/csidh/main.py . I commented the line 40 and added Alice's private key. So after my modification, line 39 ~ 45 became

    # omit line 1~39
    init_runtime()
    # a_private = random_exponents(m)

    a_private = [-2, 0, 0, 0, -4, -1, -1, 1, 0, 1, -2, 1, 0, 2, 1, 2, 0, 0, 0, 2, 1, 0, 1, 0, 0, 4, 0, 3, 0, 0, 0, -1, 0, 2, -1, 1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    assert len(a_private) == n

    a_public = GAE_at_0(a_private)
    # omit line 46~

I know that's not a good way to do it, sorry about that.

Then I ran the following command to see the public key of Alice

sibc -p p1024 -f hvelu -a csidh -s df -e 10 csidh-main
sibc -p p1024 -f hvelu -a csidh -s wd1 -e 10 csidh-main
sibc -p p1024 -f hvelu -a csidh -s wd2 -e 10 csidh-main

The outputs are

  1. df
// The running time is assuming S = 1.00 x M and a = 0.00 x M, and giving in millions of field operations.

// Exponent bounds := ( 4 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 5 5 5 5 5 5 5 5 5 4 5 4 3 3 4 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 );

// ===================== Public Key Generation
// --- Alice
// Running time (GAE):                  1.145M + 0.065S + 1.698a = 1.210M;
sk_a := ( -2 0 0 0 -4 -1 -1 1 0 1 -2 1 0 2 1 2 0 0 0 2 1 0 1 0 0 4 0 3 0 0 0 -1 0 2 -1 1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 );
pk_a := 0x60250dbf4f3acfa164280cfd7f911e04c078ac7626bc3b34bba9ebc0f89a5e675d6de1d1f48ab17b2ece19728b5eb594e64d721f58b9d29ef437b8475d1e84b9ebc9da119655314a2af27695d45c304ac877657cd05e590b46e3eb26e7173462391c1295daa7ca4d6e359645d3543acf592fe04e13052ac0ad50c0ae210a8ac;
  1. wd1
// The running time is assuming S = 1.00 x M and a = 0.00 x M, and giving in millions of field operations.

// Exponent bounds := ( 4 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 6 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 5 3 3 3 4 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 );

// ===================== Public Key Generation
// --- Alice
// Running time (GAE):                  0.774M + 0.051S + 1.177a = 0.826M;
sk_a := ( -2 0 0 0 -4 -1 -1 1 0 1 -2 1 0 2 1 2 0 0 0 2 1 0 1 0 0 4 0 3 0 0 0 -1 0 2 -1 1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 );
pk_a := 0xea4eb2f8d643e6c1c48bf1658444463b4d225c27a9287356188d0ecc8059333482a03ff6d3e1101a1c0846516c95515ffd4c0902df735a3872e161ca87d1f88faeeeea09d9b46b05176d5e0df43228a0554a2ff020cd7b3e750473fad07864eb52db5d252560a58273393691536111d965d54d381d25aaa7e93385873ceb1c;
  1. wd2
// The running time is assuming S = 1.00 x M and a = 0.00 x M, and giving in millions of field operations.

// Exponent bounds := ( 3 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 3 5 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 );

// ===================== Public Key Generation
// --- Alice
// Running time (GAE):                  0.640M + 0.037S + 0.872a = 0.677M;
sk_a := ( -2 0 0 0 -4 -1 -1 1 0 1 -2 1 0 2 1 2 0 0 0 2 1 0 1 0 0 4 0 3 0 0 0 -1 0 2 -1 1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 );
pk_a := 0x4d7263e488ccc3c1515436dc2262ce86323c40af01b8e795c44fc1b39cc9359f0b2b9492f97df14ee69f40579d6299ecf94aef274e2cff6f9988017d8a2eb3a8b6e1d8b0f59e9331202059dc060a375bb4db5d29787ddeabe8f6668948265ebca56b979df5102c6817f6373644cc79f071f8fe1eacddeedb672abf8523f37f;

These three pk_a are different, and wd2's result coincide with my implementations.

I implemented three versions of CSIDH. One of them is highly simplified, using isogeny of sagemath 10.1+. That one only computes the codomain, but doesn't push any point through the isogeny.

I'm sorry if I'm mistaken. Thank you in advance!

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.