MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / randomHex

Function randomHex

internal/payment/webhook.go:479–486  ·  view source on GitHub ↗
(n int)

Source from the content-addressed store, hash-verified

477}
478
479func randomHex(n int) string {
480 buf := make([]byte, n)
481 if _, err := rand.Read(buf); err != nil {
482 // crypto/rand 在正常系统上不可能失败;若失败则 panic 而非回退到可预测值
483 panic(fmt.Sprintf("payment: crypto/rand.Read failed: %v", err))
484 }
485 return fmt.Sprintf("%x", buf)
486}

Callers 2

provisionNewUserMethod · 0.85
emailToUsernameFunction · 0.85

Calls 1

ReadMethod · 0.45

Tested by

no test coverage detected