forked from mtusi2026/mtusi2026lab3
17 lines
237 B
Go
17 lines
237 B
Go
package ident
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"encoding/hex"
|
|
)
|
|
|
|
const tokenBytes = 32
|
|
|
|
func GenerateToken() string {
|
|
buf := make([]byte, tokenBytes)
|
|
if _, err := rand.Read(buf); err != nil {
|
|
panic(err)
|
|
}
|
|
return hex.EncodeToString(buf)
|
|
}
|