class method self.hex

Ruby on Rails 2.3.18

Since v2.2.3 Last seen in v3.0.20

Available in: v2.2.3 v2.3.18 v3.0.20

Signature

self.hex(n=nil)

SecureRandom.hex generates a random hex string.

The argument n specifies the length of the random length. The length of the result string is twice of n.

If n is not specified, 16 is assumed. It may be larger in future.

If secure random number generator is not available, NotImplementedError is raised.

Parameters

n opt = nil
Source
# File activesupport/lib/active_support/secure_random.rb, line 137
      def self.hex(n=nil)
        random_bytes(n).unpack("H*")[0]
      end

Defined in activesupport/lib/active_support/secure_random.rb line 137 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::SecureRandom

Type at least 2 characters to search.

↑↓ navigate · open · esc close