Recently, I updated my encryption library (dcrypt) support customization of the cipher and checksum options. This allows for the usage of smaller block and hash sizes, which is useful in size-limited applications. Coupled with base62 encoding, encrypted blobs are safe for most protocols.
Smaller hashes and block sizes are less secure. You will have to be the judge of what security level is adequate. The example below uses the smallest values possible (blowfish + crc32).
Once you have added the TinyCrypt, use tinker
to view the sizes of your encrypted tokens.
Plaintext string size is on the left; final output size is at the far right.
$x = 1; while($x <= 100) {$b = \App\Models\TinyCrypt::encrypt(str_repeat("A", $x)) ; echo $x . ' --> ' . $b . '(' . strlen($b) . ')' . PHP_EOL; $x++;}