Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- A coding puzzle


httpwebwitch - 4:28 am on Sep 10, 2011 (gmt 0)


b'o'Lan, that's brilliant.
Can you post an example of say 20 codes generated by that?

I had an idea on my drive home today.

strtoupper(base_convert(uniqid(),16,36))


produces some nice sized strings, with no collisions. What I don't like about them is how they all start with "DKZT" (or at least today they do) and they look like sequential strings

To make them *look* more unpredictable, I could shuffle the letters in a predictable way... like:

ABCDEFGHIJ => JAIBHCGDFE

this would turn my previous examples into:

DKZT9L1S5J -> JD5KSZ1TL9
DKZT9QVRYN -> NDYKRZVTQ9
DKZT9V0VWD -> DDWKVZ0TV9
DKZT9YA4A1 -> 1DAK4ZATY9
DKZTA2XPBZ -> ZDBKPZXT2A
DKZTA7BS5R -> RD5KSZBT7A


Thread source:: http://www.webmasterworld.com/php/4360695.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com