Skip to content

Commit

Permalink
Changes to code style (#34)
Browse files Browse the repository at this point in the history
* followed ameba linting https://crystal-ameba.github.io/
* followed crystal coding style convention https://crystal-lang.org/reference/conventions/coding_style.html
* removed unreachable code
* version bump
  • Loading branch information
cserb committed Feb 11, 2020
1 parent 1d67eac commit bec7a9f
Show file tree
Hide file tree
Showing 31 changed files with 433 additions and 451 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ add the `secp256k1` library to your `shard.yml`
dependencies:
secp256k1:
github: q9f/secp256k1.cr
version: "~> 0.2"
version: "~> 0.3"
```
# usage
Expand All @@ -51,8 +51,8 @@ this library exposes the following modules (in logical order):

* `Secp256k1`: necessary constants and data structures, including:
- `Secp256k1::Keypair`: for managing private-public key-pairs
- `Secp256k1::EC_Point`: for handling of secp256k1 elliptic curve points (public keys)
- `Secp256k1::ECDSA_Signature`: for secp256k1 ecdsa signatures
- `Secp256k1::ECPoint`: for handling of secp256k1 elliptic curve points (public keys)
- `Secp256k1::ECDSASignature`: for secp256k1 ecdsa signatures
* `Secp256k1::Core`: the entire core mathematics behind the elliptic curve cryptography
* `Secp256k1::Util`: all tools for the handling of private-public key-pairs
* `Secp256k1::Hash`: implementation of various hashing algorithms for convenience
Expand Down
24 changes: 12 additions & 12 deletions docs/Secp256k1.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.32.0">
<meta name="generator" content="Crystal Docs 0.31.1">

<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/doc.js"></script>
Expand Down Expand Up @@ -65,13 +65,13 @@

</li>

<li class=" " data-id="github.com/q9f/secp256k1.cr/Secp256k1/EC_Point" data-name="secp256k1::ec_point">
<a href="Secp256k1/EC_Point.html">EC_Point</a>
<li class=" " data-id="github.com/q9f/secp256k1.cr/Secp256k1/ECDSASignature" data-name="secp256k1::ecdsasignature">
<a href="Secp256k1/ECDSASignature.html">ECDSASignature</a>

</li>

<li class=" " data-id="github.com/q9f/secp256k1.cr/Secp256k1/ECDSA_Signature" data-name="secp256k1::ecdsa_signature">
<a href="Secp256k1/ECDSA_Signature.html">ECDSA_Signature</a>
<li class=" " data-id="github.com/q9f/secp256k1.cr/Secp256k1/ECPoint" data-name="secp256k1::ecpoint">
<a href="Secp256k1/ECPoint.html">ECPoint</a>

</li>

Expand Down Expand Up @@ -175,35 +175,35 @@ <h2>
</h2>


<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/bitcoin.cr#L16" target="_blank">
<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/bitcoin.cr#L16" target="_blank">
bitcoin.cr
</a>

<br/>


<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/constants.cr#L22" target="_blank">
<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/constants.cr#L22" target="_blank">
constants.cr
</a>

<br/>


<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/structs.cr#L20" target="_blank">
<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/structs.cr#L20" target="_blank">
structs.cr
</a>

<br/>


<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/version.cr#L20" target="_blank">
<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/version.cr#L20" target="_blank">
version.cr
</a>

<br/>


<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/secp256k1.cr#L30" target="_blank">
<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/secp256k1.cr#L30" target="_blank">
secp256k1.cr
</a>

Expand All @@ -225,7 +225,7 @@ <h2>
<dl>

<dt class="entry-const" id="EC_BASE_G">
<strong>EC_BASE_G</strong> = <code><span class="t">EC_Point</span>.<span class="k">new</span>(<span class="t">EC_BASE_G_X</span>, <span class="t">EC_BASE_G_Y</span>)</code>
<strong>EC_BASE_G</strong> = <code><span class="t">ECPoint</span>.<span class="k">new</span>(<span class="t">EC_BASE_G_X</span>, <span class="t">EC_BASE_G_Y</span>)</code>
</dt>

<dd class="entry-const-doc">
Expand Down Expand Up @@ -321,7 +321,7 @@ <h2>


<dt class="entry-const" id="VERSION">
<strong>VERSION</strong> = <code><span class="s">&quot;0.2.2&quot;</span></code>
<strong>VERSION</strong> = <code><span class="s">&quot;0.3.0&quot;</span></code>
</dt>

<dd class="entry-const-doc">
Expand Down
56 changes: 28 additions & 28 deletions docs/Secp256k1/Bitcoin.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.32.0">
<meta name="generator" content="Crystal Docs 0.31.1">

<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/doc.js"></script>
Expand Down Expand Up @@ -65,13 +65,13 @@

</li>

<li class=" " data-id="github.com/q9f/secp256k1.cr/Secp256k1/EC_Point" data-name="secp256k1::ec_point">
<a href="../Secp256k1/EC_Point.html">EC_Point</a>
<li class=" " data-id="github.com/q9f/secp256k1.cr/Secp256k1/ECDSASignature" data-name="secp256k1::ecdsasignature">
<a href="../Secp256k1/ECDSASignature.html">ECDSASignature</a>

</li>

<li class=" " data-id="github.com/q9f/secp256k1.cr/Secp256k1/ECDSA_Signature" data-name="secp256k1::ecdsa_signature">
<a href="../Secp256k1/ECDSA_Signature.html">ECDSA_Signature</a>
<li class=" " data-id="github.com/q9f/secp256k1.cr/Secp256k1/ECPoint" data-name="secp256k1::ecpoint">
<a href="../Secp256k1/ECPoint.html">ECPoint</a>

</li>

Expand Down Expand Up @@ -171,7 +171,7 @@ <h2>
</h2>


<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/bitcoin.cr#L16" target="_blank">
<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/bitcoin.cr#L16" target="_blank">
bitcoin.cr
</a>

Expand Down Expand Up @@ -209,9 +209,9 @@ <h2>
</li>

<li class="entry-summary">
<a href="#address_from_public_point(p:Secp256k1::EC_Point,version=&quot;00&quot;,compressed=true)-class-method" class="signature"><strong>.address_from_public_point</strong>(p : Secp256k1::EC_Point, version = <span class="s">&quot;00&quot;</span>, compressed = <span class="n">true</span>)</a>
<a href="#address_from_public_point(p:Secp256k1::ECPoint,version=&quot;00&quot;,compressed=true)-class-method" class="signature"><strong>.address_from_public_point</strong>(p : Secp256k1::ECPoint, version = <span class="s">&quot;00&quot;</span>, compressed = <span class="n">true</span>)</a>

<div class="summary"><p>Generates a <code><a href="../Secp256k1/Bitcoin.html">Bitcoin</a></code> address from an public key as <code><a href="../Secp256k1/EC_Point.html">EC_Point</a></code>.</p></div>
<div class="summary"><p>Generates a <code><a href="../Secp256k1/Bitcoin.html">Bitcoin</a></code> address from an public key as <code><a href="../Secp256k1/ECPoint.html">ECPoint</a></code>.</p></div>

</li>

Expand Down Expand Up @@ -339,7 +339,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/bitcoin.cr#L570" target="_blank">View source</a>]
[<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/bitcoin.cr#L563" target="_blank">View source</a>]

</div>
</div>
Expand Down Expand Up @@ -372,34 +372,34 @@ <h2>
<br/>
<div>

[<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/bitcoin.cr#L472" target="_blank">View source</a>]
[<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/bitcoin.cr#L467" target="_blank">View source</a>]

</div>
</div>

<div class="entry-detail" id="address_from_public_point(p:Secp256k1::EC_Point,version=&amp;quot;00&amp;quot;,compressed=true)-class-method">
<div class="entry-detail" id="address_from_public_point(p:Secp256k1::ECPoint,version=&amp;quot;00&amp;quot;,compressed=true)-class-method">
<div class="signature">

def self.<strong>address_from_public_point</strong>(p : <a href="../Secp256k1/EC_Point.html">Secp256k1::EC_Point</a>, version = <span class="s">&quot;00&quot;</span>, compressed = <span class="n">true</span>)
def self.<strong>address_from_public_point</strong>(p : <a href="../Secp256k1/ECPoint.html">Secp256k1::ECPoint</a>, version = <span class="s">&quot;00&quot;</span>, compressed = <span class="n">true</span>)

<a class="method-permalink" href="#address_from_public_point(p:Secp256k1::EC_Point,version=&quot;00&quot;,compressed=true)-class-method">#</a>
<a class="method-permalink" href="#address_from_public_point(p:Secp256k1::ECPoint,version=&quot;00&quot;,compressed=true)-class-method">#</a>
</div>

<div class="doc">

<p>Generates a <code><a href="../Secp256k1/Bitcoin.html">Bitcoin</a></code> address from an public key as <code><a href="../Secp256k1/EC_Point.html">EC_Point</a></code>.</p>
<p>Generates a <code><a href="../Secp256k1/Bitcoin.html">Bitcoin</a></code> address from an public key as <code><a href="../Secp256k1/ECPoint.html">ECPoint</a></code>.</p>

<p>Parameters:</p>

<ul><li><code>p</code> (<code><a href="../Secp256k1/EC_Point.html">EC_Point</a></code>): the public key as point with <code>x</code> and <code>y</code> coordinates.</li><li><code>version</code> (<code>String</code>): the version byte, default: <code>"00"</code> (Bitcoin).</li><li><code>compressed</code> (<code>Bool</code>): indicator if address should be compressed or not, default: <code>true</code> (compressed).</li></ul>
<ul><li><code>p</code> (<code><a href="../Secp256k1/ECPoint.html">ECPoint</a></code>): the public key as point with <code>x</code> and <code>y</code> coordinates.</li><li><code>version</code> (<code>String</code>): the version byte, default: <code>"00"</code> (Bitcoin).</li><li><code>compressed</code> (<code>Bool</code>): indicator if address should be compressed or not, default: <code>true</code> (compressed).</li></ul>

<p>See <code><a href="../Secp256k1/Bitcoin.html#address_from_public_key(pub:String,version=&quot;00&quot;)-class-method">.address_from_public_key</a></code> and <code><a href="../Secp256k1/EC_Point.html">EC_Point</a></code> for usage instructions.</p>
<p>See <code><a href="../Secp256k1/Bitcoin.html#address_from_public_key(pub:String,version=&quot;00&quot;)-class-method">.address_from_public_key</a></code> and <code><a href="../Secp256k1/ECPoint.html">ECPoint</a></code> for usage instructions.</p>
</div>

<br/>
<div>

[<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/bitcoin.cr#L512" target="_blank">View source</a>]
[<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/bitcoin.cr#L506" target="_blank">View source</a>]

</div>
</div>
Expand Down Expand Up @@ -429,7 +429,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/bitcoin.cr#L532" target="_blank">View source</a>]
[<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/bitcoin.cr#L526" target="_blank">View source</a>]

</div>
</div>
Expand Down Expand Up @@ -461,7 +461,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/bitcoin.cr#L396" target="_blank">View source</a>]
[<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/bitcoin.cr#L392" target="_blank">View source</a>]

</div>
</div>
Expand Down Expand Up @@ -491,7 +491,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/bitcoin.cr#L254" target="_blank">View source</a>]
[<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/bitcoin.cr#L253" target="_blank">View source</a>]

</div>
</div>
Expand All @@ -515,7 +515,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/bitcoin.cr#L193" target="_blank">View source</a>]
[<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/bitcoin.cr#L193" target="_blank">View source</a>]

</div>
</div>
Expand Down Expand Up @@ -545,7 +545,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/bitcoin.cr#L232" target="_blank">View source</a>]
[<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/bitcoin.cr#L232" target="_blank">View source</a>]

</div>
</div>
Expand Down Expand Up @@ -575,7 +575,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/bitcoin.cr#L343" target="_blank">View source</a>]
[<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/bitcoin.cr#L341" target="_blank">View source</a>]

</div>
</div>
Expand Down Expand Up @@ -605,7 +605,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/bitcoin.cr#L369" target="_blank">View source</a>]
[<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/bitcoin.cr#L366" target="_blank">View source</a>]

</div>
</div>
Expand Down Expand Up @@ -636,7 +636,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/bitcoin.cr#L279" target="_blank">View source</a>]
[<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/bitcoin.cr#L277" target="_blank">View source</a>]

</div>
</div>
Expand Down Expand Up @@ -664,7 +664,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/bitcoin.cr#L312" target="_blank">View source</a>]
[<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/bitcoin.cr#L310" target="_blank">View source</a>]

</div>
</div>
Expand Down Expand Up @@ -692,7 +692,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/bitcoin.cr#L327" target="_blank">View source</a>]
[<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/bitcoin.cr#L325" target="_blank">View source</a>]

</div>
</div>
Expand Down Expand Up @@ -722,7 +722,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/q9f/secp256k1.cr/blob/22fc923228949b495a7c4842683d270569e2151c/src/bitcoin.cr#L421" target="_blank">View source</a>]
[<a href="https://github.com/q9f/secp256k1.cr/blob/f6ea8e70d50b6270fa3f31c07fb97831baff6d5b/src/bitcoin.cr#L416" target="_blank">View source</a>]

</div>
</div>
Expand Down
Loading

0 comments on commit bec7a9f

Please sign in to comment.