Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rk
Created January 14, 2012 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rk/1611849 to your computer and use it in GitHub Desktop.
Save rk/1611849 to your computer and use it in GitHub Desktop.
A failing Diffie-Hellman WIP project in Go. Apparently Go cannot find the "big" package that it comes with?
package main
import (
"fmt"
cr "crypto/rand"
"os"
enc "encoding/ascii85"
"big"
)
func main() {
var (
f *os.File
s []byte
b = big.NewInt(0)
)
const G = 7
f, _ = os.Open("/dev/urandom")
defer f.Close()
var P, _ = cr.Prime(f, 1024)
s = make( []byte, enc.MaxEncodedLen(len(P.Bytes())) )
_ = enc.Encode(s, P.Bytes())
fmt.Printf("Prime: %s", s)
// var xa = cr.Int(f, 1 << 16)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment