Example #1
0
File: ip.go Project: ZiRo-/srndv2
// given an address
// generate a new encryption key for it
// return the encryption key and the encrypted address
func NewAddrEnc(addr string) (string, string) {
	key_bytes := nacl.RandBytes(encAddrBytes())
	key := base64.StdEncoding.EncodeToString(key_bytes)
	return key, EncAddr(addr, key)
}
Example #2
0
// make a random string
func randStr(length int) string {
	return hex.EncodeToString(nacl.RandBytes(length))[length:]
}