ManaPHP\Security\Secint::encode PHP Метод

encode() публичный Метод

Encodes a variable number of parameters to generate a hash.
public encode ( integer $id, string $type = '' ) : string
$id integer
$type string
Результат string the generated hash
    public function encode($id, $type = '')
    {
        if (!isset($this->_keys[$type])) {
            $this->_keys[$type] = md5($this->_key . $type, true);
        }
        while (true) {
            $rand = mt_rand() & 0xffff0000;
            $r = base64_encode(mcrypt_encrypt(MCRYPT_XTEA, $this->_keys[$type], pack('VV', $id, $rand), MCRYPT_MODE_ECB));
            if (strcspn($r, '+/') === 12) {
                return substr($r, 0, -1);
            }
        }
        return $id;
    }