multiple testing concepts

This commit is contained in:
2024-07-20 07:29:48 -05:00
parent 268cbcf62a
commit 2c6aed01ae
5 changed files with 93 additions and 0 deletions

34
cmd/unix/main.go Normal file
View File

@ -0,0 +1,34 @@
package main
import (
"fmt"
"unsafe"
"golang.org/x/sys/unix"
)
const (
RNDGETENTCNT int = 0x80045200
)
func main() {
var (
fd int
err error
)
if fd, err = unix.Open("/dev/random", unix.O_RDONLY, 0); err != nil {
fmt.Printf("Error: %v\n", err)
}
defer unix.Close(fd)
var (
ent int
)
_, _, errno := unix.Syscall(unix.SYS_IOCTL, uintptr(fd), uintptr(RNDGETENTCNT), uintptr(unsafe.Pointer(&ent)))
if errno != 0 {
fmt.Printf("Error: %v\n", errno)
}
fmt.Printf("Available Entropy: %v\n", ent)
}