Builds a Uuid

@param CodecInterface $codec The codec to use for building this Uuid
@param array $fields An array of fields from which to construct the Uuid;
see {@see \Ramsey\Uuid\UuidInterface::getFieldsHex()} for array structure.
@return Uuid
485967
public function build(CodecInterface $codec, array $fields)
    {
        return new Uuid($fields, $this->numberConverter, $codec, $this->timeConverter);
    }
1350730
public function generate(CodeGeneratorRequest $request, $fileDescriptors): CodeGeneratorResponse
    {
        $this->parseParameter($request->getParameter());

        $this->genMetadata($request);

        $filesToGenerate = iterator_to_array($request->getFileToGenerate());
        foreach ($fileDescriptors as $i => $fileDescriptor) {
            if (!in_array($fileDescriptor->getName(), $filesToGenerate)) {
                continue;
            }
            $this->_generateFiles($fileDescriptor);
        }

        $response = new CodeGeneratorResponse();
        $response->setFile($this->responseFiles);
        return $response;
    }
177026
static protected function uuid()
		{
			// Use the random or the server name (if present) in the generation of UUID
			$base = md5(uniqid(rand(), true));

			// Mark as "random" UUID, set version
			$byte = hexdec( substr ($base, 12, 2));
			$byte = $byte & hexdec('0F');
			$byte = $byte | hexdec('40');
			$base = substr_replace($base, strtoupper (dechex ($byte)), 12, 2);

			// Set the variant
			$byte = hexdec (substr ($base, 16, 2));
			$byte = $byte & hexdec('3F');
			$byte = $byte | hexdec('80');
			$base = substr_replace($base, strtoupper (dechex ($byte)), 16, 2);

			// Format
			return strtolower(sprintf('%s-%s-%s-%s-%s', substr($base, 0, 8),	substr($base, 8, 4), substr($base, 12, 4), substr($base, 16, 4), substr($base, 20, 12)));
		}
1282704
public static function fromBytes(string $bytes): Uuid
    {
        if (strlen($bytes) !== 16) {
            $message = sprintf('%s expects $bytes to be a 16-bytes string', __METHOD__);
            throw new DomainException($message);
        }

        $steps = [];
        foreach (range(0, 15) as $i) {
            $steps[] = sprintf('%02x', ord($bytes[$i]));
            if (in_array($i, [3, 5, 7, 9])) {
                $steps[] = '-';
            }
        }

        return static::parse(implode('', $steps));
    }
141487
public static function buildIDField($name) {
		$field				= new static($name, 'ref');
		$TYPE				= $field->getType();
		$field->args		= $TYPE->parseArgs(array());
		$field->default		= null;
		$field->writable	= false;
		$field->nullable	= false;
		return $field;
	}
158586
public function generateSignature($content, VirgilPrivateKey $signerPrivateKey)
    {
        try {
            return $this->cryptoService->sign($content, $signerPrivateKey->getValue());
        } catch (Exception $exception) {
            throw new VirgilCryptoException($exception->getMessage());
        }
    }
1243477
function(codec)
	{
		if (codec != null)
		{
			var name = codec.getName();
			mxCodecRegistry.codecs[name] = codec;
			
			var classname = mxUtils.getFunctionName(codec.template.constructor);

			if (classname != name)
			{
				mxCodecRegistry.addAlias(classname, name);
			}
		}

		return codec;
	}
470584
public function ucs2Encode($codePoints)
    {
        $outStr = '';
        foreach ($codePoints as $v) {
            if( 0x10000 <= $v && $v <= 0x10FFFF) {
                $v -= 0x10000;
                $w1 = 0xD800 | ($v >> 10);
                $w2 = 0xDC00 | ($v & 0x03FF);
                $outStr .= chr(0xFF & ($w1 >> 8)) . chr(0xFF & $w1);
                $outStr .= chr(0xFF & ($w2 >> 8)) . chr(0xFF & $w2);
            }else{
                $outStr .= chr(0xFF & ($v >> 8)) . chr(0xFF & $v);
            }
        }
        return $outStr;
    }
680425
static public function uuid($value, $message = null, $propertyPath = null)
        {
            $value = str_replace(
                array(
                    'urn:',
                    'uuid:',
                    '{', '}'
                ),
                '',
                $value
            );

            if ($value === '00000000-0000-0000-0000-000000000000') {
                return;
            }

            if (!preg_match('/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[1-5][0-9A-Fa-f]{3}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/', $value)) {
                $message = $message ?: sprintf(
                    'Value "%s" is not a valid UUID.',
                    static::stringify($value)
                );

                throw static::createException($value, $message, static::INVALID_UUID, $propertyPath);
            }
        }
1092390
private static function fromRamseyUuid(\Ramsey\Uuid\Uuid $uuid)
    {
        return new self(
            $uuid->getFieldsHex(),
            $uuid->getNumberConverter(),
            \Ramsey\Uuid\Uuid::getFactory()->getCodec()
        );
    }
273151
public function generateUuid()
    {
        $format = '%04x%04x-%04x-%04x-%04x-%04x%04x%04x';

        return sprintf(
            $format,
            // 32 bits for "time_low"
            mt_rand(0, 0xffff),
            mt_rand(0, 0xffff),
            // 16 bits for "time_mid"
            mt_rand(0, 0xffff),
            // 16 bits for "time_hi_and_version",
            // four most significant bits holds version number 4
            mt_rand(0, 0x0fff) | 0x4000,
            // 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
            mt_rand(0, 0x3fff) | 0x8000,
            // 48 bits for "node"
            mt_rand(0, 0xffff),
            mt_rand(0, 0xffff),
            mt_rand(0, 0xffff)
        );
    }
637488
public static function createUid(): string
    {
        $uid = str_replace('-', '', Uuid::uuid4()->toString());

        $checksum_a = 0; // a sum of the bytes
        $checksum_b = 0; // a sum of the incremental values of $checksum_a

        // Compute checksums
        for ($i = 0; $i < 32; $i += 2) {
            $checksum_a += hexdec(substr($uid, $i, 2));
            $checksum_b += $checksum_a & 0xff;
        }

        return strtoupper($uid . substr(dechex($checksum_a), -2) . substr(dechex($checksum_b), -2));
    }
105894
public int getCodec(final Class<?> clazz) {
    if (clazz == null) {
      throw new IllegalArgumentException("Clazz cannot be null.");
    }
    final Integer id = codecs_ids.get(clazz);
    if (id == null) {
      throw new IllegalArgumentException("No codec ID assigned to class " 
          + clazz);
    }
    return id;
  }
1282904
public function sign($payload, $key)
    {
        if (!$key instanceof Key) {
            $key = new Key($key);
        }
        $privateKey = $this->keyParser->parsePrivateKey($key->getContent());

        $hash = $this->hash($payload);

        $random = RandomGeneratorFactory::getRandomGenerator();
        $randomK = $random->generate($this->config->getGenerator()->getOrder());

        $signer = new EccSigner($this->adapter);
        $signature = $signer->sign($privateKey, $hash, $randomK);

        return new LcobucciJWTSignature($this->serializer->serialize($signature, $this->config->getSignatureLength()));
    }
93176
private function genCrfsToken()
    {
        $hashOrig = '';
        if (!empty($this->fields)) {
            foreach (array_keys($this->fields) as $field) {
                if ($field !== self::SEPARATOR) {
                    $hashOrig .= $field;
                }
            }
        }
        if ('' !== $hashOrig) {
            $this->crfs = sha1($hashOrig);
            $this->add($this->getName() . '_token', array(
                'type' => 'hidden',
                'value' => $this->crfs,
            ));
        }
        return $this;
    }
547008
public static function build(array $values)
    {
        $result = new static;

        foreach ($values as $field => $value) {
            /** @var $className TypeInterface */
            $result->$field = $value;
        }

        return $result;
    }
137751
@Override
    public AS_ContextSec encodeIOR(Codec codec) throws Exception {
        AS_ContextSec result = new AS_ContextSec();

        result.target_supports = 0;
        result.target_requires = 0;
        result.client_authentication_mech = Util.encodeOID(NULL_OID);
        result.target_name = Util.encodeGSSExportName(NULL_OID, "");

        return result;
    }