You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before I submit a pull request, just want to make sure whether it's necessary.
With usage of capture, we also need save the phrase to validate user input. Usually we may use session or a cache component. Well, if we choose to use cache, we also need a cache key for each capture. Thanks to the fingerprint property, we can simply use md5(json_encode($captcha->getFingerprint())) or md5(implode('', $captcha->getFingerprint())) to generate an unique key as the cache key.
As mentioned above, whether it's better to add an accessory function called getToken(), just like this:
public function getToken()
{
if (empty($this->getFingerprint())) {
throw new \Exception('Captcha token can only be accessed after built');
}
return md5(implode('', $this->getFingerprint()));
}
The text was updated successfully, but these errors were encountered:
Your method proposal will generate a lot of collision (1, 23 and 12, 3 will result in the same hash), but this can be easily fixed with a separator
The fingerprint is actually really big, with default settings there is like 64 numbers which are not binary, leading to having two time the exact same image really unlikely (there is much more probability than md5 collide for instance)
However, I like the idea of naming the file according to your fingerprint in the special case where you would like to propose the same captcha multiple time to the same user for retry (which I don't really think is a good idea though)
Before I submit a pull request, just want to make sure whether it's necessary.
With usage of capture, we also need save the phrase to validate user input. Usually we may use session or a cache component. Well, if we choose to use cache, we also need a cache key for each capture. Thanks to the
fingerprint
property, we can simply usemd5(json_encode($captcha->getFingerprint()))
ormd5(implode('', $captcha->getFingerprint()))
to generate an unique key as the cache key.As mentioned above, whether it's better to add an accessory function called
getToken()
, just like this:The text was updated successfully, but these errors were encountered: