173 lines
6.4 KiB
HTML
173 lines
6.4 KiB
HTML
<!DOCTYPE html>
|
|
<html class="writer-html5" lang="en" >
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<link rel="shortcut icon" href="../img/favicon.ico" />
|
|
<title>Generating Curves - CryptoTools documentation</title>
|
|
<link rel="stylesheet" href="../css/theme.css" />
|
|
<link rel="stylesheet" href="../css/theme_extra.css" />
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/github.min.css" />
|
|
<link href="../assets/_mkdocstrings.css" rel="stylesheet" />
|
|
|
|
<script>
|
|
// Current page data
|
|
var mkdocs_page_name = "Generating Curves";
|
|
var mkdocs_page_input_path = "example-curves.md";
|
|
var mkdocs_page_url = null;
|
|
</script>
|
|
|
|
<!--[if lt IE 9]>
|
|
<script src="../js/html5shiv.min.js"></script>
|
|
<![endif]-->
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js"></script>
|
|
<script>hljs.highlightAll();</script>
|
|
</head>
|
|
|
|
<body class="wy-body-for-nav" role="document">
|
|
|
|
<div class="wy-grid-for-nav">
|
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
|
|
<div class="wy-side-scroll">
|
|
<div class="wy-side-nav-search">
|
|
<a href=".." class="icon icon-home"> CryptoTools documentation
|
|
</a>
|
|
</div>
|
|
|
|
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="../introduction/">Introduction</a>
|
|
</li>
|
|
</ul>
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="../installation/">Installation</a>
|
|
</li>
|
|
</ul>
|
|
<p class="caption"><span class="caption-text">Low-level cryptographic</span></p>
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="../number-theory/">Number theory</a>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../group-theory/">Group theory</a>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../curves/">Curves</a>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../ecc/">Elliptic Curve Cryptography</a>
|
|
</li>
|
|
</ul>
|
|
<p class="caption"><span class="caption-text">Public Keys</span></p>
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="../rsa/">RSA</a>
|
|
</li>
|
|
</ul>
|
|
<p class="caption"><span class="caption-text">Utils</span></p>
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="../utils/">Utils</a>
|
|
</li>
|
|
</ul>
|
|
<p class="caption"><span class="caption-text">Examples</span></p>
|
|
<ul class="current">
|
|
<li class="toctree-l1"><a class="reference internal" href="../example-rsa-keys/">Generating RSA Keys</a>
|
|
</li>
|
|
<li class="toctree-l1 current"><a class="reference internal current" href="#">Generating Curves</a>
|
|
<ul class="current">
|
|
<li class="toctree-l2"><a class="reference internal" href="#a-weierstrass-curve">A Weierstrass Curve</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
|
<nav class="wy-nav-top" role="navigation" aria-label="Mobile navigation menu">
|
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
<a href="..">CryptoTools documentation</a>
|
|
|
|
</nav>
|
|
<div class="wy-nav-content">
|
|
<div class="rst-content"><div role="navigation" aria-label="breadcrumbs navigation">
|
|
<ul class="wy-breadcrumbs">
|
|
<li><a href=".." class="icon icon-home" aria-label="Docs"></a></li>
|
|
<li class="breadcrumb-item">Examples</li>
|
|
<li class="breadcrumb-item active">Generating Curves</li>
|
|
<li class="wy-breadcrumbs-aside">
|
|
</li>
|
|
</ul>
|
|
<hr/>
|
|
</div>
|
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
|
<div class="section" itemprop="articleBody">
|
|
|
|
<h1 id="generating-elliptic-curves">Generating Elliptic Curves</h1>
|
|
<p>In the following section, we are going to see how to generate Elliptic Curves and draw the curve with Python.</p>
|
|
<h2 id="a-weierstrass-curve">A Weierstrass Curve</h2>
|
|
<p>The python code below draw a Weierstrass Curve:</p>
|
|
<pre><code>#!/usr/bin/env python3
|
|
|
|
import matplotlib.pyplot as plt
|
|
from Cryptotools.Groups.curve import Curve
|
|
|
|
|
|
a = 3
|
|
b = 8
|
|
|
|
curve = Curve(a, b, Curve.WEIERSTRASS)
|
|
x = curve.x
|
|
curve.generatePoints()
|
|
y = curve.y
|
|
yn = curve.yn
|
|
points = curve.getPoints()
|
|
|
|
plt.figure(figsize=(10, 6))
|
|
plt.plot(x, y, color='b', label=f'$y^2 = x^3 + {a}x + {b}$')
|
|
plt.plot(x, yn, color='b', )
|
|
plt.legend()
|
|
plt.show()
|
|
</code></pre>
|
|
|
|
</div>
|
|
</div><footer>
|
|
<div class="rst-footer-buttons" role="navigation" aria-label="Footer Navigation">
|
|
<a href="../example-rsa-keys/" class="btn btn-neutral float-left" title="Generating RSA Keys"><span class="icon icon-circle-arrow-left"></span> Previous</a>
|
|
</div>
|
|
|
|
<hr/>
|
|
|
|
<div role="contentinfo">
|
|
<!-- Copyright etc -->
|
|
</div>
|
|
|
|
Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
|
</footer>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
<div class="rst-versions" role="note" aria-label="Versions">
|
|
<span class="rst-current-version" data-toggle="rst-current-version">
|
|
|
|
|
|
<span><a href="../example-rsa-keys/" style="color: #fcfcfc">« Previous</a></span>
|
|
|
|
|
|
</span>
|
|
</div>
|
|
<script src="../js/jquery-3.6.0.min.js"></script>
|
|
<script>var base_url = "..";</script>
|
|
<script src="../js/theme_extra.js"></script>
|
|
<script src="../js/theme.js"></script>
|
|
<script>
|
|
jQuery(function () {
|
|
SphinxRtdTheme.Navigation.enable(true);
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|