Skip to content

Instantly share code, notes, and snippets.

View queerzard's full-sized avatar
🏠
Working from home

Ozan A. Aslan queerzard

🏠
Working from home
  • 127.0.0.1, Germany
View GitHub Profile
@queerzard
queerzard / Hash.java
Created January 5, 2023 13:28
Hash Methods
private static String hash(String hashType, String inputHash) throws NoSuchAlgorithmException, IOException {
MessageDigest messageDigest = MessageDigest.getInstance(hashType);
messageDigest.update(inputHash.getBytes());
byte[] digest = messageDigest.digest();
StringBuffer stringBuffer = new StringBuffer();
for (byte byt : digest)
stringBuffer.append(String.format("%02x", byt & 0xff));
return stringBuffer.toString();
}
@queerzard
queerzard / E2EE.java
Created January 5, 2023 13:15
End to End Encryption
import java.security.*;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
import javax.crypto.Cipher;
public class E2EE {
private KeyPair keyPair;
private String publicKey;
private String privateKey;
@queerzard
queerzard / KeyTool4J.java
Last active July 12, 2022 14:02
A Java Class to generate SSL Certificates with KeyTool for Linux Systems (Builder Pattern)
import lombok.*;
import java.security.KeyStore;
public class KeyTool4J {
@Getter private String certificateOwner = "unknown";
@Getter private String organizationalUnit = "unknown";
@Getter private String organizationName = "unknown";
@Getter private String localityName = "unknown";