Encrypt password in java & c# and get the same result

47 views Asked by At

I am developing a loader ( in c# ) for an application. The application inject in a process, the application is in java ( don't ask how i inject : secret ( or not )). PROBLEME i need hwid verification beaucause i don't want everyone can acces to my app. I got many system information but it's impossible to find same hasing metod, i tried md5 :

Result in c# : BA5A5938CF02B7BF8BB0D02E1ACFC738
Result in java : F08BEE49030E21420FC1E1FA4FFF46FC

I shearshed on google for so muchh time but i didn't find other hashing method that works in this 2 language PLEASE HELP ME

Java md5 code :

    public static String md5encrypt()
        throws NoSuchAlgorithmException {
    String password = "hello";

    MessageDigest md = MessageDigest.getInstance("MD5");
    md.update(password.getBytes());
    byte[] digest = md.digest();
    String myHash = DatatypeConverter
            .printHexBinary(digest).toUpperCase();
    return myHash;
}

C# md5 code :

        public string CreateMD5Hash(string input)
    {
        // Step 1, calculate MD5 hash from input
        MD5 md5 = System.Security.Cryptography.MD5.Create();
        byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
        byte[] hashBytes = md5.ComputeHash(inputBytes);

        // Step 2, convert byte array to hex string
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < hashBytes.Length; i++)
        {
            sb.Append(hashBytes[i].ToString("X2"));
        }
        return sb.ToString();
    }
0

There are 0 answers