Generates a new GUID and returns a compressed string representation as used for IfcGloballyUniqueId
@return String with a length of 22 characters
764176
public static String getNewIfcGloballyUniqueId(){
		Guid guid = getGuidFromUncompressedString(UUID.randomUUID().toString());		
		String shortString = getCompressedStringFromGuid(guid);
		return shortString;
	}
1314381
def _generateGUID(slnfile, name):
    """"""
    m = hashlib.md5()
    # Normalize the slnfile path to a Windows path (\ separators) so
    # the generated file has a consistent GUID even if we generate
    # it on a non-Windows platform.
    m.update(bytearray(ntpath.normpath(str(slnfile)) + str(name),'utf-8'))
    solution = m.hexdigest().upper()
    # convert most of the signature to GUID form (discard the rest)
    solution = "{" + solution[:8] + "-" + solution[8:12] + "-" + solution[12:16] + "-" + solution[16:20] + "-" + solution[20:32] + "}"
    return solution
920373
public function generateGuid()
    {
        $index = 1;

        foreach ($this->parameters as $parameter => $condition) {
            $separator = ($index > 1) ? '&' : '?';

            $this->guid .= "{$separator}{$parameter}=\$matches[{$index}]";

            $index++;
        }

        return $this;
    }
45839
public static String getCompressedStringFromGuid(Guid guid)
	{
	    long[] num = new long[6];
	    char[][] str = new char[6][5];
	    int i,j,n;
	    String result = new String();

	    //
	    // Creation of six 32 Bit integers from the components of the GUID structure
	    //
	    num[0] = (long)(guid.Data1 / 16777216);                                                //    16. byte  (pGuid->Data1 / 16777216) is the same as (pGuid->Data1 >> 24)
	    num[1] = (long)(guid.Data1 % 16777216);                                                // 15-13. bytes (pGuid->Data1 % 16777216) is the same as (pGuid->Data1 & 0xFFFFFF)
	    num[2] = (long)(guid.Data2 * 256 + guid.Data3 / 256);                                  // 12-10. bytes
	    num[3] = (long)((guid.Data3 % 256) * 65536 + guid.Data4[0] * 256 + guid.Data4[1]);     // 09-07. bytes
	    num[4] = (long)(guid.Data4[2] * 65536 + guid.Data4[3] * 256 + guid.Data4[4]);          // 06-04. bytes
	    num[5] = (long)(guid.Data4[5] * 65536 + guid.Data4[6] * 256 + guid.Data4[7]);          // 03-01. bytes
	    //
	    // Conversion of the numbers into a system using a base of 64
	    //
	    n = 3;
	    for (i = 0; i < 6; i++) {
	        if (!cv_to_64 (num[i], str[i], n)) {
	            return null;
	        }
		    for(j = 0; j<str[i].length; j++)
		    	if(str[i][j]!= '\0') result += str[i][j];
	        
	        n = 5;
	    }
	    return result;
	}
883393
protected function getUniqueToken()
    {
        $length = 64;

        if (function_exists('random_bytes')) {
            return base64_encode(random_bytes($length));
        }

        if (function_exists('openssl_random_pseudo_bytes')) {
            return base64_encode(openssl_random_pseudo_bytes($length));
        }

        if (function_exists('password_hash')) {
            // We're using a cost of only 4 since it's not a matter
            // of having a strong hash, but rather a random token
            return base64_encode(password_hash(uniqid(), PASSWORD_DEFAULT, [
                'cost' => 4
            ]));
        }

        // It seems like we don't have any decent librarues installed
        // that can produce a some what secure random string of bytes
        // so let's use some old method (which won't be as secure)

        // This is not a very cryptographically secure token, but without
        // any other extensions, you can't really do that much.

        $token = '';
        for ($i = 0; $i < 4; $i++) {
            $token .= uniqid(rand(0,10000));
        }

        return base64_encode(str_shuffle($token));
    }
842222
public static function GUID()
	{
		if ( function_exists( 'com_create_guid' ) === true )
		{
			return trim( com_create_guid(), '{}' );
		}

		return sprintf( '%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand( 0, 65535 ), mt_rand( 0, 65535 ), mt_rand( 0, 65535 ), mt_rand( 16384, 20479 ), mt_rand( 32768, 49151 ), mt_rand( 0, 65535 ), mt_rand( 0, 65535 ), mt_rand( 0, 65535 ) );
	}
674457
public static String xidToString(Xid xid) {
    return xid.getFormatId() + "_"
        + Base64.encodeBytes(xid.getGlobalTransactionId(), Base64.DONT_BREAK_LINES) + "_"
        + Base64.encodeBytes(xid.getBranchQualifier(), Base64.DONT_BREAK_LINES);
  }
841188
function gid(length) {
      if (isUdf(length)) length = 12;
      var charSet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', id = '', i = -1;
      while (++i< length) id += charSet[random(charSet.length)];
      return id;
    }
808378
public static String generateRid() {
        byte[] encode = Base64.getEncoder().encode(DigestUtils.sha256(UUID.randomUUID().toString()));
        try {
            String rid = new String(encode, StandardCharsets.UTF_8.name());
            rid = StringUtils.replaceChars(rid, "+/=", "");
            return StringUtils.right(rid, RID_LENGTH);
        } catch (UnsupportedEncodingException e) {
            throw new IllegalStateException(e);
        }
    }
544404
public static function uid10(): string
    {
        $converted = base_convert(self::$hex_chars[random_int(0, 15)] . uniqid('', true) . self::$hex_chars[random_int(0, 15)], 16, 10);
        $res = '';

        for ($i = floor(log10((float)$converted) / 1.7923916894983); $i >= 0; --$i) {
            // Random index
            $j = 62 ** $i;
            $a = (int)floor($converted / $j);
            $res .= self::$alphanum_chars[$a];

            $converted -= $a * $j;
        }

        return sprintf('%010s', $res);
    }
1060076
public static String compressGuidString(String uncompressedString){
		Guid guid = getGuidFromUncompressedString(uncompressedString);
		return getCompressedStringFromGuid(guid);
	}
252295
function guid(moduleId) {
   var S4 = function() {
      return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
   };
   return moduleId + '@' + (S4()+S4());
}
415369
public static function generateUniqueId($maxLength = null)
    {
        $entropy = '';

        // try ssl first
        if (function_exists('openssl_random_pseudo_bytes')) {
            $entropy = openssl_random_pseudo_bytes(64, $strong);
            // skip ssl since it wasn't using the strong algo
            if ($strong !== true) {
                $entropy = '';
            }
        }

        // add some basic mt_rand/uniqid combo
        $entropy .= uniqid(mt_rand(), true);

        // try to read from the windows RNG
        if (class_exists('COM')) {
            try {
                $com = new COM('CAPICOM.Utilities.1');
                $entropy .= base64_decode($com->GetRandom(64, 0));
            } catch (Exception $ex) {
            }
        }

        // try to read from the unix RNG
        if (is_readable('/dev/urandom')) {
            $h = fopen('/dev/urandom', 'rb');
            $entropy .= fread($h, 64);
            fclose($h);
        }

        $hash = hash('whirlpool', $entropy);
        if ($maxLength) {
            return substr($hash, 0, $maxLength);
        }

        return $hash;
    }
1207618
public function generateRequestKey()
    {
        $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
        $charactersLength = strlen($characters);
        $requestKey = '';
        for ($i = 0; $i < 40; $i++) {
            $requestKey .= $characters[rand(0, $charactersLength - 1)];
        }
        return $requestKey;
    }
1307117
public static function generateGUID()
    {
        $guidStr = '';
        for ($i = 1; $i <= 16; $i++) {
            $b = (int)mt_rand(0, 0xff);
            if ($i == 7) {
                $b &= 0x0f;
                $b |= 0x40;
            } // version 4 (random)
            if ($i == 9) {
                $b &= 0x3f;
                $b |= 0x80;
            } // variant
            $guidStr .= sprintf('%02s', base_convert($b, 10, 16));
            if ($i == 4 || $i == 6 || $i == 8 || $i == 10) {
                $guidStr .= '-';
            }
        }

        return $guidStr;
    }
993308
function guid( $contentObject, $languageCode = '' )
    {
        if ( !$contentObject instanceof eZContentObject )
            return md5( self::installationID() . '-' . $contentObject . '-' . $languageCode );

        return md5( self::installationID() . '-' . $contentObject->attribute( 'id' ) . '-' . $languageCode );
    }
126865
private static synchronized Long generateGuid() {
        StringBuilder builder = new StringBuilder();
        builder.append(System.currentTimeMillis());
        builder.append(guidCounter++);
        // Reset the counter if it gets too high.  It's always a number
        // between 100 and 999 so that the # of digits in the guid is
        // always the same.
        if (guidCounter > 999) {
            guidCounter = 100;
        }
        return Long.parseLong(builder.toString());
    }