Class: UUniqueIds
- Inherits:
-
Object
- Object
- UUniqueIds
- Defined in:
- lib/uunique_ids/uunique_ids.rb
Class Method Summary collapse
Class Method Details
.random_create ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/uunique_ids/uunique_ids.rb', line 12 def random_create raw_uuid = ::UUIDTools::UUID.random_create.to_s chaffed_uuid = ::EzChaff.chaff(raw_uuid) sha1 = ::Digest::SHA1.hexdigest(chaffed_uuid) return sha1 end |
.random_dns_uuid_create ⇒ Object
21 22 23 24 25 26 |
# File 'lib/uunique_ids/uunique_ids.rb', line 21 def random_dns_uuid_create bytes = SecureRandom.random_bytes(16) random_int = ::UUIDTools::UUID.convert_byte_string_to_int(bytes) sha1_dns = UUIDTools::UUID.sha1_create(UUIDTools::UUID_DNS_NAMESPACE, "www.helium.com".dup + random_int.to_s) return sha1_dns.to_s end |