extend and fix pubkeys

This commit is contained in:
Sen 2025-05-29 12:51:39 +02:00
parent 5a394749bf
commit 902c795ecc
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
5 changed files with 184 additions and 64 deletions

View file

@ -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);
}
}