Another method, which would also shorten the string, would be to compute the hash md5 / sha1 of the string (if you want) (<concretized with the seed):
import hashlib >>> hashlib.sha1("12234_1_Hello'World_34433_22acb_4554344_accCC44").hexdigest() 'e1153227558aadc00a2e90b5013fdd6b0804fdfb'
In theory, you should get a rowset with very few collisions and a fixed length. The hashlib library has an array of different hash functions that you can use this way with different release sizes.
Edit: You also said that you need a reversible string, so this will not work. Afaik, however, many web platforms that use pure URLs, for example, you seem to want to use hash functions to calculate the abbreviated URL, and then save that URL along with a page of other data to allow reverse search.
source share