Version 3 UUID are based on namespace and name utilizing a md5 hash.

If you are considering using v3 consider using v5 instead as that is what
is recommended.

@see https://en.wikipedia.org/wiki/UUID#Version_3_.28MD5_hash.29
487137
public static function createV3($namespace, $name) {
    // If the namespace is not a valid UUID we throw an error.
    if (!self::isValid($namespace)) {
      throw new Exception('The UUID provided for the namespace is not valid.');
    }

    $bin = self::bin($namespace);

    $hash = md5($bin . $name);

    return new self (sprintf('{%08s-%04s-%04x-%04x-%12s}',

      // 32 bits for "time_low"
      substr($hash, 0, 8),

      // 16 bits for "time_mid"
      substr($hash, 8, 4),

      // 16 bits for "time_hi_and_version",
      // four most significant bits holds version number 3
      (hexdec(substr($hash, 12, 4)) & 0x0fff) | 0x3000,

      // 16 bits, 8 bits for "clk_seq_hi_res",
      // 8 bits for "clk_seq_low",
      // two most significant bits holds zero and one for variant DCE1.1
      (hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000,

      // 48 bits for "node"
      substr($hash, 20, 12)
    ), self::V3, $namespace, $name);

  }
673798
function formatUuid(Uuid) {
	var formatted='';
	//expand short service/characteristic UUID
	if (Uuid.length == 4) {
		formatted='0000' + Uuid + '-0000-1000-8000-00805f9b34fb';
	}
	else { //just add dashes 
		formatted = Uuid.slice(0,8)+'-'+Uuid.slice(8,12)+'-'+Uuid.slice(12,16)+'-'+Uuid.slice(16,20)+'-'+Uuid.slice(20,32);
	}
	return formatted;
}
139003
func NewUUID(namespace, name string) ([]byte, error) {
	hash := md5.New()
	_, err := hash.Write([]byte(namespace))
	if err != nil {
		return nil, errors.Wrapf(err, "could not compute hash value for namespace %q", namespace)
	}
	_, err = hash.Write([]byte(name))
	if err != nil {
		return nil, errors.Wrapf(err, "could not compute hash value for name %q", name)
	}

	sum := hash.Sum(nil)

	uuid := make([]byte, 16)
	copy(uuid, sum)

	// set version(v3)
	internal.SetVersion(uuid, internal.VersionNameBasedMD5)
	// set layout(RFC4122)
	internal.SetLayout(uuid, internal.LayoutRFC4122)

	return uuid, nil
}
1077097
public static function v3($namespace, $name)
    {
        if (!Validate::isValidUUID($namespace)) {
            return false;
        }

        // Get hexadecimal components of namespace
        $nhex = str_replace(array('-', '{', '}'), '', $namespace);

        // Binary Value
        $nstr = '';

        // Convert Namespace UUID to bits
        for ($i = 0; $i < strlen($nhex); $i += 2) {
            $nstr .= \chr(hexdec($nhex[$i] . $nhex[$i + 1]));
        }

        // Calculate hash value
        $hash = md5($nstr . $name);

        return sprintf('%08s-%04s-%04x-%04x-%12s',

            // 32 bits for "time_low"
            substr($hash, 0, 8),

            // 16 bits for "time_mid"
            substr($hash, 8, 4),

            // 16 bits for "time_hi_and_version",
            // four most significant bits holds version number 3
            (hexdec(substr($hash, 12, 4)) & 0x0fff) | 0x3000,

            // 16 bits, 8 bits for "clk_seq_hi_res",
            // 8 bits for "clk_seq_low",
            // two most significant bits holds zero and one for variant DCE1.1
            (hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000,

            // 48 bits for "node"
            substr($hash, 20, 12)
        );
    }
672046
function KdbxUuid(ab) {
    if (ab === undefined) {
        ab = new ArrayBuffer(UuidLength);
    }
    if (typeof ab === 'string') {
        ab = ByteUtils.base64ToBytes(ab);
    }
    this.id = ab.byteLength === 16 ? ByteUtils.bytesToBase64(ab) : undefined;
    this.empty = true;
    if (ab) {
        var bytes = new Uint8Array(ab);
        for (var i = 0, len = bytes.length; i < len; i++) {
            if (bytes[i] !== 0) {
                this.empty = false;
                return;
            }
        }
    }
}
840787
protected static function uuid5($namespace, string $name): Uuid
    {
        if (!($namespace instanceof self)) {
            $namespace = static::parse($namespace);
        }

        $hash = sha1($namespace->toBytes().$name);

        return static::fromUnformatted($hash, static::VERSION_SHA1);
    }
1048989
func NewUUIDv3(ns UUID, name []byte) (UUID, error) {
	uuid := UUID{}
	hash := md5.New()
	hash.Write(ns.dump())
	hash.Write(name)
	copy(uuid[:], hash.Sum([]byte{})[:16])

	uuid.setVersion(UUIDv3)
	uuid.setVariant(UUIDVariantRFC4122)
	return uuid, nil
}
600699
public static boolean isValidUUID(String uuid) {

        try {
            return (null != uuid) && (null != UUID.valueOf(uuid));
        } catch (NumberFormatException e) {
            // return false
        }
        return false;
    }
1038481
public static String shortUuid() {
        // source: java.util.UUID.randomUUID()
        final byte[] randomBytes = new byte[16];
        UUID_GENERATOR.nextBytes(randomBytes);
        randomBytes[6] = (byte) (randomBytes[6] & 0x0f); // clear version
        randomBytes[6] = (byte) (randomBytes[6] | 0x40); // set to version 4
        randomBytes[8] = (byte) (randomBytes[8] & 0x3f); // clear variant
        randomBytes[8] = (byte) (randomBytes[8] | 0x80); // set to IETF variant

        // all base 64 encoding schemes use A-Z, a-z, and 0-9 for the first 62 characters. for the
        // last 2 characters, we use hyphen and underscore, which are URL safe
        return BaseEncoding.base64Url().omitPadding().encode(randomBytes);
    }
280891
def is_uuid(u):
    """"""
    if isinstance(u, str) and u.replace('-', '') == uuid.UUID(u).hex:
        return u
    return False
223414
def uuid_to_username(uuid):
    
    uuid_data = getattr(uuid, 'bytes', None) or UUID(uuid).bytes
    b32coded = base64.b32encode(uuid_data)
    return 'u-' + b32coded.decode('ascii').replace('=', '').lower()
745496
public static function generateUUID() :string
    {
        return sprintf(
            '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
            mt_rand(0, 0xffff),
            mt_rand(0, 0xffff),
            mt_rand(0, 0xffff),
            mt_rand(0, 0x0fff) | 0x4000,
            mt_rand(0, 0x3fff) | 0x8000,
            mt_rand(0, 0xffff),
            mt_rand(0, 0xffff),
            mt_rand(0, 0xffff)
        );
    }
1146234
private static function uuid4()
    {
        $bytes =
            function_exists('openssl_random_pseudo_bytes')
                ? openssl_random_pseudo_bytes(16)
                : self::generateBytes(16);


        $hash = bin2hex($bytes);

        // Set the version number
        $timeHi = hexdec(substr($hash, 12, 4)) & 0x0fff;
        $timeHi &= ~(0xf000);
        $timeHi |= 4 << 12;

        // Set the variant to RFC 4122
        $clockSeqHi = hexdec(substr($hash, 16, 2)) & 0x3f;
        $clockSeqHi &= ~(0xc0);
        $clockSeqHi |= 0x80;

        $fields = [
            'time_low' => substr($hash, 0, 8),
            'time_mid' => substr($hash, 8, 4),
            'time_hi_and_version' => sprintf('%04x', $timeHi),
            'clock_seq_hi_and_reserved' => sprintf('%02x', $clockSeqHi),
            'clock_seq_low' => substr($hash, 18, 2),
            'node' => substr($hash, 20, 12),
        ];

        return vsprintf(
            '%08s-%04s-%04s-%02s%02s-%012s',
            $fields
        );
    }
177814
public static UUID nameUUIDFromBytes(byte[] name) {
		MessageDigest md;
		try {
			md = MessageDigest.getInstance("MD5");
		} catch (NoSuchAlgorithmException nsae) {
			throw new InternalError("MD5 not supported");
		}
		byte[] md5Bytes = md.digest(name);
		md5Bytes[6] &= 0x0f; /* clear version */
		md5Bytes[6] |= 0x30; /* set to version 3 */
		md5Bytes[8] &= 0x3f; /* clear variant */
		md5Bytes[8] |= 0x80; /* set to IETF variant */
		return new UUID(md5Bytes);
	}
148025
private function uuid(): string
    {
        return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
            mt_rand(0, 0xffff), mt_rand(0, 0xffff),
            mt_rand(0, 0xffff),
            mt_rand(0, 0x0fff) | 0x4000,
            mt_rand(0, 0x3fff) | 0x8000,
            mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
        );
    }
959819
def uuid(self):
        '''
        '''
        pk = self.pkvalue()
        if not pk:
            raise self.DoesNotExist(
                'Object not saved. Cannot obtain universally unique id')
        return self.get_uuid(pk)
921633
public static function uuid()
    {
        mt_srand((double)microtime() * 10000);
        $charId = md5(uniqid(rand(), true));
        $uuid = [
            substr($charId, 0, 8),
            substr($charId, 8, 4),
            substr($charId, 12, 4),
            substr($charId, 16, 4),
            substr($charId, 20, 12)
        ];

        return join('-', $uuid);
    }