Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6762755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:23:42+00:00 2026-05-26T14:23:42+00:00

in the last 5 hours im trying to do something that should be very

  • 0

in the last 5 hours im trying to do something that should be very simple and did it in like 10 minutes in C#, but no luck with Java.
I got a 32 UpperCase and Numeric String (A-Z0-9), I need to convert this String to Dec, and then md5 it.
My problem is that I dont have unsgined bytes so I cant md5 my array :\

Here is what I need to do in python:

salt = words[1].decode("hex")
passwordHash = generatePasswordHash(salt, pw)
generatePasswordHash(salt, password):
    m = md5.new()
    m.update(salt)
    m.update(password)
    return m.digest()

and here it is in C# :

public static string GeneratePasswordHash(byte[] a_bSalt, string strData) {
    MD5 md5Hasher = MD5.Create();

    byte[] a_bCombined = new byte[a_bSalt.Length + strData.Length];
    a_bSalt.CopyTo(a_bCombined, 0);
    Encoding.Default.GetBytes(strData).CopyTo(a_bCombined, a_bSalt.Length);

    byte[] a_bHash = md5Hasher.ComputeHash(a_bCombined);

    StringBuilder sbStringifyHash = new StringBuilder();
    for (int i = 0; i < a_bHash.Length; i++) {
        sbStringifyHash.Append(a_bHash[i].ToString("X2"));
    }

    return sbStringifyHash.ToString();
}

protected byte[] HashToByteArray(string strHexString) {
    byte[] a_bReturn = new byte[strHexString.Length / 2];

    for (int i = 0; i < a_bReturn.Length; i++) {
        a_bReturn[i] = Convert.ToByte(strHexString.Substring(i * 2, 2), 16);
    }

    return a_bReturn;
}

I will be very happy to get a help with this 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:23:43+00:00Added an answer on May 26, 2026 at 2:23 pm

    To parse a hex string into a byte : (byte) Integer.parseInt(s, 16).

    To transform your password string into a byte array, using the default encoding (which I suggest not to do : always specify a specific encoding) : password.getBytes() (or password.getBytes(encoding) for a specific encoding).

    To hash a byte array : MessageDigest.getInstance("MD5").digest(byte[]).

    To transform a byte to a hex String : See In Java, how do I convert a byte array to a string of hex digits while keeping leading zeros?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have passed the last couple of hours trying to downgrade Java to 1.6.0_13
I spent few hours trying to resolve one very strange issue, but I really
This is something that I figure should be straightforward, but I can't seem to
This may seem like a simple question however i've spent the last hour trying
I've been spending the last few hours trying to find the memory leak in
I am trying to list last visits per hour in last 24 hours. I
I was trying to build Boost C++ Libraries for last two hours and stopped
I've been scratching my head about this for the last 4 hours, trying out
i have googled in the last 3 hours but i can't seem to find
I've been stuck with this simple Sql query for last 3 hours and my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.