Generates a v4 UUID from data.

@param string $data

@return string
193807
public static function v4FromData($data)
    {
        assert(strlen($data) == 16);

        $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
        $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10

        return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
    }
72153
public function createSign($data)
	{
		$data = $data . self::getSecretKey() . self::getPrivateKey();
		return md5($data);
	}
1299070
public static function getUUID(): string {
        $data = random_bytes(16);
        $data[6] = chr(ord($data[6]) & 0x0f | 0x40);
        $data[8] = chr(ord($data[8]) & 0x3f | 0x80);
        return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
    }
494977
public function encode(string $data): string
    {
        if (true === $this->options["check"]) {
            $data = chr($this->options["version"]) . $data;
            $hash = hash("sha256", $data, true);
            $hash = hash("sha256", $hash, true);
            $checksum = substr($hash, 0, 4);
            $data .= $checksum;
        }

        $data = str_split($data);
        $data = array_map("ord", $data);

        $leadingZeroes = 0;
        while (!empty($data) && 0 === $data[0]) {
            $leadingZeroes++;
            array_shift($data);
        }

        $converted = $this->baseConvert($data, 256, 58);

        if (0 < $leadingZeroes) {
            $converted = array_merge(
                array_fill(0, $leadingZeroes, 0),
                $converted
            );
        }

        return implode("", array_map(function ($index) {
            return $this->options["characters"][$index];
        }, $converted));
    }
1371219
public static function decrypt($data) : string {
      $crypter = new Crypter();

      return $crypter->decrypt($data, self::getAppKey());
    }
980921
public function decrypt($data){
        $data = base64_decode($data);
        $maxlength = $this->getMaxDecryptBlockSize($this->privateKey);
        $output='';
        while(strlen($data)){
            $input = substr($data, 0, $maxlength);
            $data = substr($data, $maxlength);
            openssl_private_decrypt($input, $out, $this->privateKey);
            $output .= $out;
        }
        return $output;
    }
1041699
public function generate(string $content = null): string
    {
        if (empty($content)) {
            $guid = Uuid::uuid4();
        } else {
            $guid = Uuid::uuid5(Uuid::NAMESPACE_DNS, $content);
        }

        return $guid->toString();
    }
1163898
public function encrypt($data)
	{
		if (!$this->encEnabled) return $data; // no encryption
		switch ($this->encMethod) {
			case 'SIMPLE':
				return $this->encryptSimple($data);
			case 'INTEGER':
				return $this->encryptInteger($data);
		}
		if ($this->iv) {
			$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($this->encMethod));
		} else {
			$iv=substr(md5($data,true),0,openssl_cipher_iv_length($this->encMethod));
		}
		$encrypted_string = bin2hex($iv) . openssl_encrypt($this->encSalt . $data, $this->encMethod, $this->encPassword, 0, $iv);
		return str_replace(array('+', '/'), array('-', '_'),base64_encode($encrypted_string));
	}
433012
protected static function getUrlSafeData($data)
    {
        $remainder = strlen($data) % 4;

        if ($remainder) {
            $data .= str_repeat('=', 4 - $remainder);
        }

        return strtr($data, '-_', '+/');
    }
583770
function generate_key($data)
    {
        $this->load_pgp_driver();
        $result = $this->pgp_driver->gen_key($data);

        if ($result instanceof enigma_error) {
            self::raise_error($result, __LINE__);
        }

        return $result;
    }
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);
    }
917928
public static function encode($data)
    {
        switch (gettype($data)) {
            case 'array':
                return self::encodeArray($data);
            case 'object':
                return self::encodeObject($data);
            case 'string':
                return self::encodeString($data);
            case 'integer':
                return self::encodeInteger($data);
            case 'boolean':
                return self::encodeBoolean($data);
            case 'double':
                return self::encodeDouble($data);
            case 'NULL':
                return self::encodeNull($data);
            case 'resource':
                // TODO
                break;
            default:
                throw new UnencodeableException('Contains unencodeable type', 3);
        }
    }
1108121
public function generate(array $data): string
    {
        /** @var RecordFinder $recordFinder */
        $recordFinder = GeneralUtility::makeInstance(RecordFinder::class);
        $staticDataRecords = $recordFinder->findUidsOfStaticdata();
        // Select first two
        return implode(',', array_slice($staticDataRecords, 0, 2));
    }
1200282
private function generateUUID()
    {
        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)
        );
    }
636768
private function generateSignature($data)
    {
        return base64_encode(
            hash_hmac('sha512',
                $this->getMerchantId() . $data . $this->getMerchantId(),
                $this->getPrivateKey())
        );
    }
665185
public function extractId(&$data)
    {
        $id = NULL;
        if (isset($data[$this->idField])) {
            $id = $data[$this->idField];
            unset($data[$this->idField]);
        }
        return $id;
    }
559589
public static function encodeData($data)
    {
        if (\is_array($data)) {
            foreach ($data as $key => $value) {
                $data[$key] = \urlencode($value);
            }

            return $data;
        }

        return \urlencode($data);
    }