github.com/gramework/gramework@v1.8.1-0.20231027140105-82555c9057f5/grypto/salt/salt.go (about)

     1  package salt
     2  
     3  import (
     4  	"crypto/rand"
     5  	"errors"
     6  )
     7  
     8  var nonNilErr = errors.New("<placeholder>")
     9  
    10  func Generate(bytes int) []byte {
    11  	x := make([]byte, bytes)
    12  
    13  	err := nonNilErr
    14  	for err != nil {
    15  		_, err = rand.Read(x)
    16  	}
    17  
    18  	return x
    19  }
    20  
    21  func Gen128() []byte {
    22  	return Generate(16)
    23  }