summaryrefslogtreecommitdiff
path: root/lib/rubygems
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems/vendor/securerandom/lib/random/formatter.rb17
-rw-r--r--lib/rubygems/vendor/securerandom/lib/securerandom.rb2
2 files changed, 9 insertions, 10 deletions
@@ -165,13 +165,13 @@ module Gem::Random::Formatter
#
# The result contains 122 random bits (15.25 random bytes).
#
- # See RFC4122[https://datatracker.ietf.org/doc/html/rfc4122] for details of UUID.
#
def uuid
- ary = random_bytes(16).unpack("NnnnnN")
- ary[2] = (ary[2] & 0x0fff) | 0x4000
- ary[3] = (ary[3] & 0x3fff) | 0x8000
- "%08x-%04x-%04x-%04x-%04x%08x" % ary
end
alias uuid_v4 uuid
@@ -201,11 +201,10 @@ module Gem::Random::Formatter
#
# The result contains 74 random bits (9.25 random bytes).
#
- # Note that this method cannot be made reproducable because its output
# includes not only random bits but also timestamp.
#
- # See draft-ietf-uuidrev-rfc4122bis[https://datatracker.ietf.org/doc/draft-ietf-uuidrev-rfc4122bis/]
- # for details of UUIDv7.
#
# ==== Monotonicity
#
@@ -242,7 +241,7 @@ module Gem::Random::Formatter
#
# Counters and other mechanisms for stronger guarantees of monotonicity are
# not implemented. Applications with stricter requirements should follow
- # {Section 6.2}[https://www.ietf.org/archive/id/draft-ietf-uuidrev-rfc4122bis-07.html#monotonicity_counters]
# of the specification.
#
def uuid_v7(extra_timestamp_bits: 0)
@@ -41,7 +41,7 @@ require_relative 'random/formatter'
module Gem::SecureRandom
# The version
- VERSION = "0.3.1"
class << self
# Returns a random binary string containing +size+ bytes.