import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
public class Main {
public static String getSha1(byte[] str) {
char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
try {
MessageDigest mdTemp = MessageDigest.getInstance("SHA1");
mdTemp.update(str);
byte[] md = mdTemp.digest();
int j = md.length;
char buf[] = new char[j * 2];
int k = 0;
for (int i = 0; i < j; i++) {
byte byte0 = md[i];
buf[k++] = hexDigits[byte0 >>> 4 & 0xf];
buf[k++] = hexDigits[byte0 & 0xf];
}
return new String(buf);
} catch (Exception e) {
return null;
}
}
private static byte[] long2byte(long j) {
byte[] bArr = new byte[8];
int i = 0;
while (i < 8) {
int i2 = i + 1;
bArr[i] = (byte) ((int) ((j >> (64 - (i2 * 8))) & 255));
i = i2;
}
return bArr;
}
private static String sha1Hex(long j, String str) {
byte[] long2byte = long2byte(j);
byte[] bytes = str.getBytes();
for (int i = 0; i < bytes.length; i = (byte) (i + 1)) {
bytes[i] = (byte) (bytes[i] + i);
}
byte[] bArr = new byte[16];
System.arraycopy(bytes, 0, bArr, 0, 8);
System.arraycopy(long2byte, 0, bArr, 8, 8);
return getSha1(bArr);
}
public static void main(String[] args) {
System.out.println(sha1Hex(1625131401004L,"jt97&^%!"));
}
}