UUID URL 安全吗?我想将其用作备用 ID,但也许允许将记录作为 URL 中的 ID 进行访问。虽然我可以使用 Ruby 的 SecureRandom.urlsafe_base64(27)
来获取相同长度的随机 Base64 编码字符串,但 UUID 看起来更干净。
最佳答案
是的。
A UUID仅由十六进制字符(a–f、0–9)和连字符 (-) 组成。
根据RFC 3986 (URI Syntax) §2.3 、连字符和十六进制字符包含在那些明确未保留的字符中:
Characters that are allowed in a URI but do not have a reserved purpose are called unreserved. These include uppercase and lowercase letters, decimal digits, hyphen, period, underscore, and tilde.
关于url - UUID 是 "URL safe"吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57163770/