Files
XACrypto/src/de/caydenno1/xacrypto/hash/SHA256.java
T
xiao bce829a4cc read desc for info
SHA256.java is the MessageDigest usage, it sucks, don't use it.

SHA256Advanced.java is my custom interpretation but i don't have the time right now to finish it so for now it will sadly be a placeholder.
2026-05-25 23:19:27 -04:00

26 lines
921 B
Java

package de.caydenno1.xacrypto.hash;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class SHA256 {
// THIS IS A TEMPORARY FILE AND EXTREMELY VOLATILE!! it will be removed when i create a more advanced sha256 (i just dont have the time rn so this will be here for now)
// this just uses MessageDigest and is extremely BAD! do not use this, do not use it, dont use itttt! lol //
// you have been warned. //
private SHA256(){};
public static String hash(String raw) throws NoSuchAlgorithmException {
MessageDigest dig = MessageDigest.getInstance("SHA-256");
byte[] res = dig.digest(raw.getBytes(StandardCharsets.UTF_8));
StringBuilder hex = new StringBuilder();
for (byte b :res) {
hex.append(String.format("%02x", b));
}
return hex.toString();
};
}