TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Nanocoin – A minimal cryptocurrency implemented in Haskell

171 pointsby lambdaxdotxover 7 years ago

3 comments

mrkgnaoover 7 years ago
The extensive README is also a pretty good intro to how one can do crypto (as in cryptography: get off my lawn!) in Haskell using the excellent <i>cryptonite</i> library.<p>For those who won&#x27;t click through to TFR:<p><pre><code> &gt; import Crypto.Number.Hash (SHA3_256) &gt; import Crypto.PubKey.ECC.ECDSA (sign, verify) &gt; import Crypto.PubKey.ECC.Generate (generate) &gt; import Crypto.PubKey.ECC.Types (getCurveByName, SEC_p256k1) &gt; let msg = &quot;hello world&quot; :: ByteString &gt; let secp256k1 = getCurveByName SEC_p256k1 &gt; (pubKey, privKey) &lt;- generate secp256k1 &gt; sig &lt;- sign privKey SHA3_256 msg &gt; verify SHA3_256 pubKey sig msg True</code></pre>
评论 #15141930 未加载
wycover 7 years ago
If you&#x27;re interested, here&#x27;s a secp256k1 implementation (underlying elliptical curve cryptography) in pure Haskell:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;wyc&#x2F;haschain&#x2F;blob&#x2F;master&#x2F;Secp256K1.hs" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;wyc&#x2F;haschain&#x2F;blob&#x2F;master&#x2F;Secp256K1.hs</a><p>Should probably wrap it into a Group or something. Of course it&#x27;s not secure, just for fun.
toppyover 7 years ago
Another well documented blockchain implementation in Haskell: <a href="http:&#x2F;&#x2F;www.michaelburge.us&#x2F;2017&#x2F;08&#x2F;17&#x2F;rolling-your-own-blockchain.html" rel="nofollow">http:&#x2F;&#x2F;www.michaelburge.us&#x2F;2017&#x2F;08&#x2F;17&#x2F;rolling-your-own-block...</a>