Home > other >  Serial number algorithm
Serial number algorithm

Time:09-16

Have a master can explain it in detail in the following code algorithm, is what kind of algorithm is the string "BF6W3A776" down into C, C, D, D, B of each variable, only read the exclusive or, as with & amp; 15, left shift & lt; <4 what is method? And how will, in turn, C, C, D, D, B generated "BF6W3A776"? Thank you,


 
String STR="BF6W3A776";
Byte C, C, D, D, B;

Byte [] bytes=new ASCIIEncoding () GetBytes (" m @ nq& 3 $r3T @ i1rM # ");
Abcdefghjklmnpqrtuvwxy int num4=(" 0123456789 ". IndexOf (STR [0]) ^ bytes/4% bytes. The Length) & amp; 15.
for (int i=0; I & lt; 4. I++)
{
If ((num4 & amp; (1 & lt; <(I & amp; 0 x1f)))!=0)
{
Abcdefghjklmnpqrtuvwxy int index="0123456789". IndexOf (STR) [(I * 2) + 1];
Int num3=((" 0123456789 abcdefghjklmnpqrtuvwxy ". IndexOf (STR) [(I * 2) + 2] <4) + index) ^ bytes [I % bytes. The Length].
If (I==3)
{
C=(byte) ((num3 & amp; 240) & gt;> 4);//1
D=(byte) (num3 & amp; 15);//6
}
Else if (I==2)
{
D=(byte) num3;//20
}
Else if (I==1)
{
C=(byte) num3;
}
Else if (I==0)
{
B=(byte) num3;
}
}
}

CodePudding user response:

Should be a hash algorithm to
Should not return
  • Related