Created
January 14, 2012 15:51
-
-
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?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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