<script language="javascript">
var n=0;
function calc(){
var username=document.getElementById("username").value;
var i=0;
var s1='';var sn='';
var ax,dx,di;
if(username.length<3){alert('注册名长度不能小于3!');return;};
if(username.length>15){username=username.substr(0,15);};//15位以上的用户名忽略超出部分
n=Math.floor(0xFFFFFFFF/(a(username,0)%a(username,1)*a(username,2)+1));
for(i=0;i<15;i++){
ax=f134a();
//s1+=String.fromCharCode(ax%0x1a+0x41);//不需要
//ax=Math.floor(ax/0x1a);//不需要
}
for(i=0;i<username.length;i++){
ax=a(username,i)>>5;
dx=ax+ax*4;ax=ax+dx*8;di=ax+ax*2;
for(var k=0;k<=di;k++)ax=f134a();
sn+=String.fromCharCode(ax%0x1a+0x41);
}
w(sn);
}
function f134a(){
n=(n*0x343fd+0x269ec3);
var ss=n.toString(16);
if(ss.length>8)n=parseInt('0x'+ss.substring(ss.length-8,ss.length));
return (n>>16)&0x7fff;
};
function w(str){document.getElementById("sn").value=str;}
function w16(n){document.getElementById("sn").value=n.toString(16);}
function a(str,pos){return str.substr(pos,1).charCodeAt();}
</script>