/** * Generate token basing on field names and custom key * * @param string|null $salt Encryption salt * * @return string * @throws \InvalidArgumentException */ public function tokenize($salt = null) { if ($salt === null) { $salt = $this->encrypter->randSalt(); } $value = implode('', array_keys($this->fields)); $token = $this->encrypter->crypt($value, $salt); return $token; }