keygen
2013-12-06 16:50
246 查看
publicclassKeyGen{ publicstaticshortgetCRC(Strings,inti,byte[]bytes){ CRC32crc32=newCRC32(); if(s!=null){ for(intj=0;j<s.length();j++){ charc=s.charAt(j); crc32.update(c); } } crc32.update(i); crc32.update(i>>8); crc32.update(i>>16); crc32.update(i>>24); for(intk=0;k<bytes.length-2;k++){ bytebyte0=bytes[k]; crc32.update(byte0); } return(short)(int)crc32.getValue(); } publicstaticStringencodeGroups(BigIntegerbiginteger){ BigIntegerbeginner1=BigInteger.valueOf(60466176L); StringBuildersb=newStringBuilder(); for(inti=0;biginteger.compareTo(BigInteger.ZERO)!=0;i++){ intj=biginteger.mod(beginner1).intValue(); Strings1=encodeGroup(j); if(i>0){ sb.append("-"); } sb.append(s1); biginteger=biginteger.divide(beginner1); } returnsb.toString(); } publicstaticStringencodeGroup(inti){ StringBuildersb=newStringBuilder(); for(intj=0;j<5;j++){ intk=i%36; //charc; charc; if(k<10) c=(char)(48+k); else{ c=(char)(65+k-10); } sb.append(c); i/=36; } returnsb.toString(); } publicstaticStringMakeKey(Stringname,intdays,intid,ProductTypeprtype){ id%=10000; byte[]bkey=newbyte[12]; bkey[0]=(byte)prtype.id(); bkey[1]=13; Dated=newDate(); longld=d.getTime()>>16; bkey[2]=(byte)(int)(ld&0xFF); bkey[3]=(byte)(int)(ld>>8&0xFF); bkey[4]=(byte)(int)(ld>>16&0xFF); bkey[5]=(byte)(int)(ld>>24&0xFF); days&=65535; bkey[6]=(byte)(days&0xFF); bkey[7]=(byte)(days>>8&0xFF); bkey[8]=105; bkey[9]=-59; bkey[10]=0; bkey[11]=0; intw=getCRC(name,id%10000,bkey); bkey[10]=(byte)(w&0xFF); bkey[11]=(byte)(w>>8&0xFF); BigIntegerpow=newBigInteger("89126272330128007543578052027888001981",10); BigIntegermod=newBigInteger("86f71688cdd2612ca117d1f54bdae029",16); BigIntegerk0=newBigInteger(bkey); BigIntegerk1=k0.modPow(pow,mod); Strings0=Integer.toString(id); Stringsz="0"; while(s0.length()!=5){ s0=sz.concat(s0); } s0=s0.concat("-"); Strings1=encodeGroups(k1); s0=s0.concat(s1); returns0; } }
publicenumProductType{
IDEA(1);
privateintid;
privateProductType(intid){
this.id=id;
}
publicintid(){
returnthis.id;
}
publicstaticProductTypegetProductType(Stringstr){
for(ProductTypeproduct:values())
if(product.toString().equalsIgnoreCase(str))
returnproduct;
returnnull;
}
}
相关文章推荐
- wcf系列学习5天速成——第三天 事务的使用
- 十大在线编程学习网站
- 几种超厉害的死循环代码
- 现在还买车?土豪有去买坦克了
- C#中File静态类及其常用静态方法实例详解
- 20131206孤独者之旅03
- linux 内存泄露检测工具——valgrind
- Using Flashback Drop and Managing the Recycle Bin
- 跨线程
- php 文件上传后缀名与文件类型对照表(几乎涵盖所有文件)
- 基于图的深度优先搜索和广度优先搜索java实现
- QtCreate运行程序和直接双击运行程序的区别!
- "****" is not translated in zh, zh_CN.的解决方法
- Autofac的使用
- 【转】input file accept属性可以限制的文件类型
- DBA_实践指南系列6_Oracle Erp R12工作流通知邮件配置Email(案例)
- 美迪吐血放送建站的经验总结
- android真机调试报错Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE 的解决办法
- 数据库质疑修复总结 For SQL Server 2000/2005/2008/2008R2
- iOS UIImageview实现简单动画