Go, Go and Go

I was asked a strange question today with an online interview … “On your site you use lots of programming languages. Which is your…

Go, Go and Go

I was asked a strange question today with an online interview … “On your site you use lots of programming languages. Which is your favouriate?”, and my answer was … Go.

The new scripted languages such as Python and Node.js are convenient. But, unfortunately, they can be slow as they are scripted, and not compiled. Each time the scripted code is run, the scripting engine must then convert each line of code to the required machine level code. This makes the code much slower than compiled languages, and also less robust.

Thus many applications in cryptography are written in C and C++, as they allow for fast execution and give low level access. Unfortunately it can be complex to compile programs, as we often need to install binary libraries and then link these in. The Go programming language, though, has a similar code syntax to C/C++, but is small and efficient and allows access to low-level functions, such as as pointers.

Go thus aims to “Code less, compile quicker, execute faster”.

The more I use Go, the more I like it. So let’s use Go to implement some hashing functions, and implement compiled code for cryptography:

  • Hashing with Go. Hashing. Hashes with Go.
  • GP Hashing with Go. GP Hashing. GP Hashes with Go.
  • Schnorr with Go. Schnorr. Schnorr signatures with Go.
  • RSA with Go. RSA. RSA encryption with Go.
  • Hash to password with Go. Hash to password. Hash to password with Go.
  • ECDH with Go. ECDH. ECDH with Go.
  • Box with Go. Box. Box with Go.
  • ECC with Go. ECC. ECC with Go.
  • Curve 25519 with Go. ECC. Curve 25519 is one of the most widely used elliptic curve methods, including with Tor, WhatsApp and Signal.
  • ECDH with Curve 25519 using Go. ECC. Curve 25519 is one of the most widely used elliptic curve methods, including with Tor, WhatsApp and Signal. This page uses the curve to implement ECDH.
  • ECDH with Curve 25519 using Go (Cloudfare). ECC. Curve 25519 is one of the most widely used elliptic curve methods, including with Tor, WhatsApp and Signal. This page uses the curve to implement ECDH.
  • Curve 25519 with Go for test vectors. ECC. This does a test on some private keys to test the public key generation.
  • Ed25519 with Go. ECC. This creates a signature for a message given a private and a public key.
  • ElGamal encryption with Go. ElGamal. This implements ElGamal encryption.
  • BNS-256 Crypto pairing (Triparty key exchange). BNS. Implementation of BNS-256 for triparty key exchange.
  • PGP (Symmetric) with Go. PGP (Symmetric). This implements PGP Symmetric encryption.
  • libDisco with Go. libDisco. This implements libDisco.
  • SHAKE with Go. SHAKE. This implements SHAKE in Go.
  • Extended Triple Diffie Hellman (X3DH) with Go. X3DH. This generates pre-shared public keys for X3DH.
  • Ethereum address with Go. Addresses. This generates an Ethereum address.
  • Viewing Balance of account in Etheruem with Go. Balance. This views the balance of an account
  • Viewing Block in Etheruem with Go. Block. This views a block.
  • Viewing Transactions in Block in Etheruem with Go. Transactions. This views transactions.
  • Shamir Secret Shares with Go. SSS. Creating Secret Shares.
  • SIDH Go. SIDH. Post-quantum key exchange.
  • SIKE Secret Shares with Go. SIKE. Post-quantum key exchange with key encapulation.
  • NTP. NTP. An overview of NTP.
  • BiBa. BiBa. An overview of BiBa One Time Signature.
  • DNSSEC. DNSSEC. An overview of DNSSEC.
  • ElGamal with ECC. ElGamal with ECC. ElGamal using ECC.
  • (t,n)-threshold Boneh-Lynn-Shacham (BLS) signature scheme. TBLS. Create n shares and where we need to get t back to verify the signature.
  • Non-interactive zero-knowledge (NIZK) proofs for the equality (EQ) of discrete logarithms (DL). DLEQ. Create a non-interactive ZKP for discrete logs.

Conclusions

In cryptography, you really can’t stick with a certain programming language, as the amazing new library is only available in a given language, so you forever have to jump around. That’s what makes it so much fun. One day it’s Java, the next it’s Python, and then it’s Go. For us, we are integrating Go with smart contracts and with GPUs, and we haven’t found any barriers to our work.