IntelliJ Idea 14 Registration code generation

Source: Internet
Author: User

import java.math.biginteger;import java.util.date;import java.util.random;import  java.util.zip.crc32;public class keygen {/** *  *  @param  s *   @param  i *  @param  bytes *  @return  */public static short &NBSP;GETCRC (string s, int i, byte bytes[])  {crc32 crc32 = new &NBSP;CRC32 ();if  (s != null)  {for  (int j = 0; j <  S.length ();  j++)  {char c = s.charat (j); Crc32.update (c);}} Crc32.update (i); Crc32.update (i >> 8); crc32.update (i >> 16); Crc32.update (i  >> 24);for  (int k = 0; k < bytes.length - 2;  k++)  {byte byte0 = bytes[k];crc32.update (BYTE0);} return  (short)   (int)  crc32.getvalue ();} /** *  *  @param  biginteger *  @return  */public static string encodegroups (Biginteger biginteger)  {biginteger beginner1 = biginteger.valueof (0x39aa400l); Stringbuilder sb = new stringbuilder ();for  (int i = 0;  Biginteger.compareto (Biginteger.zero)  != 0; i++)  {int j = biginteger.mod ( Beginner1). Intvalue (); String s1 = encodegroup (j);if  (i > 0)  {sb.append ("-");} Sb.append (S1); Biginteger = biginteger.divide (beginner1);} Return sb.tostring ();} /** *  *  @param  i *  @return  */public static String  Encodegroup (Int i)  {stringbuilder sb = new stringbuilder ();for  (int j  = 0; j < 5; j++)  {int k = i % 36;char c; if  (k < 10)  {c =  (char)   (48 + k);}  else {c =  (char)   ((65 + k)  - 10);} Sb.append (c); i /= 36;} Return sb.tostring ();} /** *  *  @param  name *  @param  days *  @param  id *   @return  */public static string makekey (string name, int days,  Int id)  {id %= 100000;byte bkey[] = new byte[12];bkey[0] =  ( BYTE)  1; // Product type: IntelliJ IDEA is 1bkey[1] = 14;  // versiondate d = new date ();long ld =  (D.getTime ()  > > 16);bkey[2] =  (byte)   (ld & 255);bkey[3] =  (byte)   ((LD  >> 8)  & 255);bkey[4] =  (byte)   (LD&NBSP;&GT;&GT;&NBSP;16)   & 255);bkey[5] =  (byte)   ((ld >> 24)  & 255);days &= 0xffff;bkey[6] =  (Byte)   (days & 255);bkey[7] =  ( BYTE)   ((days >> 8)  & 255);bkey[8] = 105;bkey[9] = -59; BKEY[10]&NBSP;=&NBSP;0;BKEY[11]&NBSP;=&NBSP;0;INT&NBSP;W&NBSP;=&NBSP;GETCRC (name, id % 100000,  bkey);bkey[10] =  (byte)   (w & 255);bkey[11] =  (byte)   ((w &NBSP;&GT;&GT;&NBSP;8)  & 255); Biginteger pow = new biginteger ("89126272330128007543578052027888001981",  10); Biginteger mod = new biginteger ("86f71688cdd2612ca117d1f54bdae029",  16); Biginteger k0 = new biginteger (Bkey); Biginteger k1 = k0.modpow (POW,&NBSP;MOD); String s0 = integer.tostring (ID); string sz =  "0";while  (s0.length ()  != 5)  {s0 = sz.concat (S0);} S0 = s0.concat ("-"); string s1 = Encodegroups (K1); S0 = s0.concat (S1); return s0;} /** *  *  @param  args */public static void main (String[] args )  {//args[0] =  "Plt";//if  (args.length == 0)  {//system.err.printf ("* * *  usage: %s name%n ",//keygen.class.getcanonicalname ());//system.exit (1);//}Random r =  new random (); System.out.println (Makekey ("Test",  0, r.nextint (100000));}}


IntelliJ Idea 14 Registration code generation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.