SixChars is light-weight code that generates a random looking string that represents a number (between 0 and 1,073,741,823).
It is useful for things like referral links or invite codes.
For example, you can embed a referrer's userid like this:
** This is NOT for secure encryption! **
var key = "WLZFX9KSEJG8647AHM5CQB3TPVY20RND";var sixchars = key;console;// LK8HBYconsole;// 1
...thats pretty much all there is.
You need to provide the SixChars constructor a 32 unique character key.
Don't feel like crafting the key yourself? Here- run this:
var chars = '023456789ABCDEFGHJKLMNPQRSTVWXYZ';var a = chars;//credit for randomizer goes to:var n = alength;forvar i = n - 1; i > 0; i--var j = Math;var tmp = ai;ai = aj;aj = tmp;console;
The MIT License (MIT) Copyright (c) 2014 William Kapke
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.