Method: UUID.new_sha1

Defined in:
lib/cast_off/compile/namespace/uuid.rb

.new_sha1(str, namespace) ⇒ Object

UUID generation using SHA1. Recommended over create_md5. Namespace object is another UUID, some of them are pre-defined below.



99
100
101
102
103
104
105
106
# File 'lib/cast_off/compile/namespace/uuid.rb', line 99

def new_sha1 str, namespace
  sha1 = Digest::SHA1.new
  sha1.update namespace.raw_bytes
  sha1.update str
  sum = sha1.digest
  raw = mask 5, sum[0..15]
  create raw
end