Latest recipes tagged "web_site"http://code.activestate.com/recipes/tags/web_site/new/2008-08-20T05:01:39-07:00ActiveState Code RecipesBase Conversion decimal to base = len(map) (Python) 2008-08-20T05:01:39-07:00Mark Zitnikhttp://code.activestate.com/recipes/users/4166559/http://code.activestate.com/recipes/576435-base-conversion-decimal-to-base-lenmap/ <p style="color: grey"> Python recipe 576435 by <a href="/recipes/users/4166559/">Mark Zitnik</a> (<a href="/recipes/tags/base/">base</a>, <a href="/recipes/tags/conversion/">conversion</a>, <a href="/recipes/tags/decimal/">decimal</a>, <a href="/recipes/tags/sequence/">sequence</a>, <a href="/recipes/tags/web_site/">web_site</a>). Revision 7. </p> <p>This code enable decimal base conversion according map length and a different char set.</p> <p>Example:</p> <ul> <li>map = ['0','1'] base 2 10 -> 1010</li> <li>map = ['a','b'] base 2 10 -> baba</li> <li>map = ['a','b','c','d','e','f','g','h','i','j','k','l'] base 12 10 -> k</li> <li>map = ['a','b','c','d','e','f','g','h','i','j','k','l'] base 12 100 -> ie</li> </ul> <p>this simple method can be used in web sites to hide a well known decimal sequence like user ids.</p>