Current location - Quotes Website - Signature design - JAVA logout mode is converted into PHP code, how to write it?
JAVA logout mode is converted into PHP code, how to write it?
The JAVA logout mode is converted into PHP code, as shown below:

Sig generation mode:

Keywords: aUdqk-BvLwKl

Time: current time. (dragon)

Num: random number. (dragon)

SHA 1 (key+time+number)

Take java as an example:

Private static string encryption (string key, long time, long number) {

byte[]k = key . getbytes();

byte[]t = getBytesByLong(times);

byte[]n = getBytesByLong(num);

Byte[] np = new byte [k.length+t.length+n.length];

int I = 0;

for(int j = 0; J<k. Length; j++,i++){

NP[I]= k[j];

}

for(int j = 0; J<t. Length; j++,i++){

NP[I]= t[j];

}

for(int j = 0; J<n. Length; j++,i++){

NP[I]= n[j];

}

string sha 1 = sha 1 util . getsha 1(NP);

Return sha1;

}