diff --git a/src/de/caydenno1/xacrypto/hash/SHA256.java b/src/de/caydenno1/xacrypto/hash/SHA256.java new file mode 100644 index 0000000..66acb51 --- /dev/null +++ b/src/de/caydenno1/xacrypto/hash/SHA256.java @@ -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(); + }; +} diff --git a/src/de/caydenno1/xacrypto/hash/SHA256Advanced.java b/src/de/caydenno1/xacrypto/hash/SHA256Advanced.java new file mode 100644 index 0000000..841eaf2 --- /dev/null +++ b/src/de/caydenno1/xacrypto/hash/SHA256Advanced.java @@ -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); + } + } +} diff --git a/src/de/caydenno1/xacrypto/misc/Constants.java b/src/de/caydenno1/xacrypto/misc/Constants.java index 9fe7e90..04a1f7a 100644 --- a/src/de/caydenno1/xacrypto/misc/Constants.java +++ b/src/de/caydenno1/xacrypto/misc/Constants.java @@ -21,5 +21,6 @@ public class Constants { 0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a, 0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19 }; - // placeholder ,ignore + + // (no longer a placeholder) }