Class AbstractNameBasedUuidCreator

    • Constructor Detail

      • AbstractNameBasedUuidCreator

        public AbstractNameBasedUuidCreator​(UuidVersion version,
                                            String messageDigest)
        This constructor receives the name of a message digest.
        Parameters:
        version - the version number
        messageDigest - a message digest
    • Method Detail

      • create

        public UUID create​(UUID namespace,
                           byte[] name)
        Returns a name-based UUID. ### RFC-4122 - 4.3. Algorithm for Creating a Name-Based UUID (1) Allocate a UUID to use as a "name space ID" for all UUIDs generated from names in that name space; see Appendix C for some pre-defined values. (2) Choose either MD5 [4] or SHA-1 [8] as the hash algorithm; If backward compatibility is not an issue, SHA-1 is preferred. (3) Convert the name to a canonical sequence of octets (as defined by the standards or conventions of its name space); put the name space ID in network byte order. (4) Compute the hash of the name space ID concatenated with the name. (5) Set octets zero through 3 of the time_low field to octets zero through 3 of the hash. (6) Set octets zero and one of the time_mid field to octets 4 and 5 of the hash. (7) Set octets zero and one of the time_hi_and_version field to octets 6 and 7 of the hash. (8) Set the four most significant bits (bits 12 through 15) of the time_hi_and_version field to the appropriate 4-bit version number from Section 4.1.3. (9) Set the clock_seq_hi_and_reserved field to octet 8 of the hash. (10) Set the two most significant bits (bits 6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively. (11) Set the clock_seq_low field to octet 9 of the hash. (12) Set octets zero through five of the node field to octets 10 through 15 of the hash. (13) Convert the resulting UUID to local byte order.
        Parameters:
        namespace - a name space UUID
        name - a byte array of the name
        Returns:
        a name-based UUID
      • create

        public UUID create​(UUID namespace,
                           String name)
        Returns a name-based UUID. See: create(UUID, byte[])
        Parameters:
        namespace - a name space UUID
        name - a name string
        Returns:
        a name-based UUID
      • create

        public UUID create​(UuidNamespace namespace,
                           byte[] name)
        Returns a name-based UUID. See: UuidNamespace. See: create(UUID, byte[])
        Parameters:
        namespace - a name space enumeration
        name - a byte array of the name
        Returns:
        a name-based UUID
      • create

        public UUID create​(byte[] name)
        Returns a name-based UUID. The namespace to be used set by withNamespace(UUID) See: create(UUID, byte[])
        Parameters:
        name - a byte array of the name
        Returns:
        a name-based UUID