converts a short 16-bit or 32-bit reserved UUID to a full 128-bit Bluetooth
    UUID.
169234
def to_full_uuid (uuid):
    
    if not is_valid_uuid (uuid): raise ValueError ("invalid UUID")
    if len (uuid) == 4:
        return "0000%s-0000-1000-8000-00805F9B34FB" % uuid
    elif len (uuid) == 8:
        return "%s-0000-1000-8000-00805F9B34FB" % uuid
    else:
        return uuid
1232499
public static UUID generateTxnId(int epoch, int msb, long lsb) {
        long msb64Bit = (long) epoch << 32 | msb & 0xFFFFFFFFL;
        return new UUID(msb64Bit, lsb);
    }
1232954
@VisibleForTesting
    static UUID bytesToUUID(byte[] data) {
        long msb = 0;
        long lsb = 0;
        assert data.length == 16 : "data must be 16 bytes in length";
        for (int i = 0; i < 8; i++) {
            msb = (msb << 8) | (data[i] & 0xff);
        }
        for (int i = 8; i < 16; i++) {
            lsb = (lsb << 8) | (data[i] & 0xff);
        }
        return new UUID(msb, lsb);
    }
284557
public static String getUUID() {
        UUID id = UUID.randomUUID();
        ByteBuffer bb = ByteBuffer.wrap(new byte[16]);
        bb.putLong(id.getMostSignificantBits());
        bb.putLong(id.getLeastSignificantBits());
        return Base64.encodeBase64URLSafeString(bb.array());
    }
210593
public static java.util.UUID fromUU64(String uu64) {
        String uu16 = UU16FromUU64(uu64);
        return java.util.UUID.fromString(UU(uu16));
    }
1212567
function stringToBinaryUUID(value) {
    // for compatiblity reason check if value is already converted...
    if (typeof value !== "string") {
        return value;
    }
    const hex = value.replace(/[{}-]/g, ""); // remove extra characters
    const buffer = new Buffer(hex, "hex");
    return new mongodb_1.Binary(buffer, mongodb_1.Binary.SUBTYPE_UUID);
}
7546
public static String makeGUID() {
        String uuid = "";
        String chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
        int rnd = 0;
        int r;

        for (int i = 0; i < GUID_STRING_LENGTH; i += 1) {
            if (i == 8 || i == 13 ||  i == 18 || i == 23) {
                uuid = uuid + "-";
            } else if (i == 14) {
                uuid = uuid + "4";
            } else {
                if (rnd <= 0x02) {
                    rnd = (int) (0x2000000 + Math.round(java.lang.Math.random() * 0x1000000));
                }
                r = rnd & 0xf;
                rnd = rnd >> 4;

                if (i == 19) {
                    uuid = uuid + chars.charAt((r & 0x3) | 0x8);
                } else {
                    uuid = uuid + chars.charAt(r);
                }
            }
        }
        return uuid;
    }
26400
public function uuidV4()
    {
        if (function_exists('random_bytes')) {
            $bytes = random_bytes(16);
        } else {
            $bytes = openssl_random_pseudo_bytes(16);
        }
        $hash = bin2hex($bytes);

        return $this->getFromHash($hash, 4);
    }
694703
def str_to_uuid(value):
    
    if isfunction(value):
        value = value()

    return UUID(value) if isinstance(value, string_types) else value
447560
def uuid_to_uid(uuid)
      uuid = Integer(uuid)
      if uuid >= 0 && uuid <= MAX_UUID
        10_000 + uuid
      else
        raise RangeError, "#{uuid} is not within (0..#{MAX_UUID})"
      end
    end
109832
def username_to_uuid(username):
    
    if not username.startswith('u-') or len(username) != 28:
        raise ValueError('Not an UUID based username: %r' % (username,))
    decoded = base64.b32decode(username[2:].upper() + '======')
    return UUID(bytes=decoded)
70990
def set_uuid(obj, uuid=None):
    
    from uuid import uuid4, UUID
    if uuid is None:
        uuid = uuid4()
    elif isinstance(uuid, bytes):
        if len(uuid) == 16:
            uuid = UUID(bytes=uuid)
        else:
            uuid = UUID(hex=uuid)

    if "uuid" in obj.attrs:
        del obj.attrs["uuid"]
    obj.attrs.create("uuid", str(uuid).encode('ascii'), dtype="|S36")
944853
public static function uuid4() : string
    {
        $uuid = Uuid::uuid4();
        $shortUuid = new self();
        return $shortUuid->encode($uuid);
    }
794904
function uuid() {
    var i, random;
    var uuid = '';

    for (i = 0; i < 32; i++) {
        random = Math.random() * 16 | 0;
        if (i === 8 || i === 12 || i === 16 || i === 20) {
            uuid += '-';
        }
        uuid += (i === 12 ? 4 : (i === 16 ? (random & 3 | 8) : random)).toString(16);
    }

    return uuid;
}
485167
public void setUUID(UUID uuid)
    {
        if (uuid == null)
        {
            throw new IllegalArgumentException("'uuid' is null.");
        }

        mUUID = uuid;

        long msbits = uuid.getMostSignificantBits();
        long lsbits = uuid.getLeastSignificantBits();

        byte[] data = getData();
        data[UUID_INDEX +  0] = (byte)((msbits >> 56) & 0xFF);
        data[UUID_INDEX +  1] = (byte)((msbits >> 48) & 0xFF);
        data[UUID_INDEX +  2] = (byte)((msbits >> 40) & 0xFF);
        data[UUID_INDEX +  3] = (byte)((msbits >> 32) & 0xFF);
        data[UUID_INDEX +  4] = (byte)((msbits >> 24) & 0xFF);
        data[UUID_INDEX +  5] = (byte)((msbits >> 16) & 0xFF);
        data[UUID_INDEX +  6] = (byte)((msbits >>  8) & 0xFF);
        data[UUID_INDEX +  7] = (byte)((msbits      ) & 0xFF);
        data[UUID_INDEX +  8] = (byte)((lsbits >> 56) & 0xFF);
        data[UUID_INDEX +  9] = (byte)((lsbits >> 48) & 0xFF);
        data[UUID_INDEX + 10] = (byte)((lsbits >> 40) & 0xFF);
        data[UUID_INDEX + 11] = (byte)((lsbits >> 32) & 0xFF);
        data[UUID_INDEX + 12] = (byte)((lsbits >> 24) & 0xFF);
        data[UUID_INDEX + 13] = (byte)((lsbits >> 16) & 0xFF);
        data[UUID_INDEX + 14] = (byte)((lsbits >>  8) & 0xFF);
        data[UUID_INDEX + 15] = (byte)((lsbits >>  0) & 0xFF);
    }
427012
def __uuid(*args):
        """"""

        s = '-'.join(args)

        sha1 = hashlib.sha1(s.encode('utf-8', errors='surrogateescape'))
        uuid_sha1 = sha1.hexdigest()

        return uuid_sha1
593581
public static final UUID getGUID(byte[] data, int offset)
   {
      UUID result = null;
      if (data != null && data.length > 15)
      {
         long long1 = 0;
         long1 |= ((long) (data[offset + 3] & 0xFF)) << 56;
         long1 |= ((long) (data[offset + 2] & 0xFF)) << 48;
         long1 |= ((long) (data[offset + 1] & 0xFF)) << 40;
         long1 |= ((long) (data[offset + 0] & 0xFF)) << 32;
         long1 |= ((long) (data[offset + 5] & 0xFF)) << 24;
         long1 |= ((long) (data[offset + 4] & 0xFF)) << 16;
         long1 |= ((long) (data[offset + 7] & 0xFF)) << 8;
         long1 |= ((long) (data[offset + 6] & 0xFF)) << 0;

         long long2 = 0;
         long2 |= ((long) (data[offset + 8] & 0xFF)) << 56;
         long2 |= ((long) (data[offset + 9] & 0xFF)) << 48;
         long2 |= ((long) (data[offset + 10] & 0xFF)) << 40;
         long2 |= ((long) (data[offset + 11] & 0xFF)) << 32;
         long2 |= ((long) (data[offset + 12] & 0xFF)) << 24;
         long2 |= ((long) (data[offset + 13] & 0xFF)) << 16;
         long2 |= ((long) (data[offset + 14] & 0xFF)) << 8;
         long2 |= ((long) (data[offset + 15] & 0xFF)) << 0;

         result = new UUID(long1, long2);
      }
      return result;
   }