Documentation
¶
Overview ¶
Package trng contains a random number source using an Arduino Due connected via USB.
The sketch provided produces random bits, in the form of 32bit words, every microsecond and writes them to the serial interface at 230,400 baud.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Open ¶
func Open(dev string) (io.ReadCloser, error)
Open opens a connection to the Arduino USB device. This device on linux systems is /dev/ttyACM0.
Example ¶
package main
import (
"crypto/tls"
"net"
"github.com/davecheney/trng"
)
func main() {
// open random source
rand, _ := trng.Open("/dev/ttyACM0")
// make a tls Config using that source
config := tls.Config{
Rand: rand,
}
// dial some TLS site
conn, _ := net.DialTCP("tcp", "www.google.com:443")
// use our TLS config, with our random source
// to do the handshake
client, _ := tls.Client(conn, *config)
client.Close()
}
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
example
|
|
|
random-bits
command
Provides a stream of random bits suitable for piping to other consumers of random data.
|
Provides a stream of random bits suitable for piping to other consumers of random data. |
Click to show internal directories.
Click to hide internal directories.