wa-lang.org/wazero@v1.0.2/internal/gojs/testdata/crypto/main.go (about)

     1  package crypto
     2  
     3  import (
     4  	"crypto/rand"
     5  	"encoding/hex"
     6  	"fmt"
     7  	"log"
     8  )
     9  
    10  func Main() {
    11  	b := make([]byte, 5)
    12  	if n, err := rand.Read(b); err != nil {
    13  		log.Panicln(err)
    14  	} else if n != 5 {
    15  		log.Panicln("expected 5, but have ", n)
    16  	}
    17  	fmt.Println(hex.EncodeToString(b))
    18  }