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.
This commit is contained in:
2026-05-25 23:19:27 -04:00
parent 40cfcd3fdf
commit bce829a4cc
3 changed files with 40 additions and 1 deletions
@@ -0,0 +1,25 @@
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();
};
}
@@ -0,0 +1,13 @@
package de.caydenno1.xacrypto.hash;
public final class SHA256Advanced {
private SHA256Advanced() {};
static void compress(int[] h, byte[] b, int offline){
int[] w = new int [64];
for (int i =0; i< 16;i++){
int base = offline + (i<<2);
}
}
}
@@ -21,5 +21,6 @@ public class Constants {
0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,
0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19
};
// placeholder ,ignore
// (no longer a placeholder)
}