extend and fix pubkeys
This commit is contained in:
parent
5a394749bf
commit
902c795ecc
5 changed files with 184 additions and 64 deletions
|
@ -6,6 +6,7 @@ import java.security.Key;
|
|||
import java.security.KeyFactory;
|
||||
import java.security.KeyPair;
|
||||
import java.security.KeyPairGenerator;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.PublicKey;
|
||||
|
@ -117,4 +118,23 @@ public class EncryptUtil {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getXorSha512Hash(byte[] data) {
|
||||
byte[] hash;
|
||||
try {
|
||||
MessageDigest digest = MessageDigest.getInstance("SHA-512");
|
||||
hash = digest.digest(data);
|
||||
}
|
||||
catch(NoSuchAlgorithmException e) {
|
||||
Log.SYSTEM.error(e, "Konnte Prüfwert nicht berechnen");
|
||||
return "<?>";
|
||||
}
|
||||
byte[] xor = new byte[8];
|
||||
for(int z = 0; z < hash.length / xor.length; z++) {
|
||||
for(int n = 0; n < xor.length; n++) {
|
||||
xor[n] ^= hash[z * xor.length + n];
|
||||
}
|
||||
}
|
||||
return Util.getHexString(xor);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue