Sha256: 701089248a14886de5b4ab70850856a9407fa94aaeb3480cb74ee7b551850e17
Contents?: true
Size: 375 Bytes
Versions: 12
Compression:
Stored size: 375 Bytes
Contents
require 'digest' module InlineSvg class IdGenerator class Randomness require "securerandom" def self.call SecureRandom.hex(10) end end def self.generate(base, salt, randomness: Randomness) bytes = Digest::SHA1.digest("#{base}-#{salt}-#{randomness.call}") 'a' + Digest.hexencode(bytes).to_i(16).to_s(36) end end end
Version data entries
12 entries across 12 versions & 2 rubygems