ICE Key Generator

From Valve Developer Community
Revision as of 02:55, 23 February 2008 by Kohan (talk | contribs) (Explained purpose.)

Jump to: navigation, search

This is a simple HTML script that can be used to randomly generate an encryption code for use with Vice. Note that this does not generate a code for a specific game; its intent is for developers to get a completely random key to use for their own mod(s).

Source code

<script language="JavaScript" type="text/javascript">
var chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_+-=[]{};/., ~`:<>?';
var l = chars.length-1;
document.write('<span style="font-size:5em;">');
for(var x=0;x<=7;x++)
{
	var chr = chars.charAt(Math.round(Math.random(new Date().getSeconds())*l));
	var out;
	switch(chr)
	{
		case '<':
			out = '&lt;';
			break;
		case '>':
			out = '&gt;';
			break;
		case '&':
			out = '&amp;';
			break;
		default:
			out = chr;
			break;
	}
	document.write(out);
}
document.write('</span>');
</script>