Possible Duplicate:
Short 'encryption/hash' in PHP
Right,
I need to make an ID’s e.g; 100000001, 100000002, 100000003 into less predictable strings using PHP such as PDKJ23HB43
- It needs to be alphanumerical.
- (If Possible) It needs to be 5-15 characters in length.
- It needs to be reversible.
- It needs to be unique.
- It doesn’t need to be secure [I’m not using it to ‘encrypt’ anything]
- (If Possible) It can’t require a database to record the mappings.
- Is what I’m trying to do at all possible?
I’m thinking it’s going to be similar to how URL’s get turned into TinyURL’s, but that’s only a vague guess.
I’ve tried a few different options such as base64 but the outputs are far too long (I know the reasons why, I just can’t find a better solution as this is the first time I’ve ever needed to do something like this.
Thanks for the help guys, any is greatly appreciated. Sorry if I’m asking very directly, but it’s the only way I can get my goal across.
You could use this :
If you want predictable (non secure) id, store just a count somewhere and use