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 8911831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:02:38+00:00 2026-06-15T04:02:38+00:00

Something in the back of my head is telling me I’m missing something obvious

  • 0

Something in the back of my head is telling me I’m missing something obvious here.

I’m integrating an existing java project with a third-party api that uses an md5 hash of an api key for authentication. It’s not working for me, and during debugging I realized that the hashes I’m generating don’t match the examples that they’ve supplied. I’ve found some websites that create MD5 hashes from strings to check their examples, and as far as I can tell I’m wrong and they’re right.

for example, according to this website, the string “hello” generates a hash of “5d41402abc4b2a76b9719d911017c592”. (FWIW I don’t know anything about this website except that it seems to correctly hash the examples that I have). When I run it through my code I get:

XUFAKrxLKna5cZ2REBfFkg==

Here is the simple method I’m using to generate the md5 hash/string.:

private String md5(String md5Me) throws Exception {
    MessageDigest md = MessageDigest.getInstance("MD5");
    md.reset();
    md.update(md5Me.getBytes("UTF-8"));

    return Base64.encodeBase64String(md.digest());
}

I used a very similar method to successfully authenticate a different API using the SHA1 algorithm last week. I’m wondering if the problem is related to the org.apache.commons.net.util.Base64.encodeBase64String… Any help is greatly appreciated, if only some tests to see if the byteArray is correct but the converted string is wrong.

  • 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-06-15T04:02:39+00:00Added an answer on June 15, 2026 at 4:02 am

    for example, according to this website, the string "hello" generates a hash of "5d41402abc4b2a76b9719d911017c592". (FWIW I don’t know anything about this website except that it seems to correctly hash the examples that I have). When I run it through my code I get:

    XUFAKrxLKna5cZ2REBfFkg==

    Both are correct ways of representing the same sixteen-byte hash. 5d41402abc4b2a76b9719d911017c592 represents each byte of the hash as two hexadecimal digits, whereas XUFAKrxLKna5cZ2REBfFkg== uses Base-64 to represent every three bytes of the hash as four characters.

    To generate the hexadecimal-version that this third-party API is expecting, you can change this:

    Base64.encodeBase64String(md.digest());
    

    to this:

    String.format("%032x", new BigInteger(1, md.digest()));
    

    (mostly taken from this StackOverflow answer).

    However, you might want to consider using an external library for this. Perception, in a comment above, mentions Apache Commons DigestUtils. If you use that, you’ll want the md5hex method.

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

Sidebar

Related Questions

Okay, I'm pretty sure I'm missing something very obvious here, but I just couldn't
I'm getting my head back into SubSonic on a project with v2.1 fairly embedded
I remember reading something about it a few years back but I don't remember
I am creating an app where if something occurs, it switches back to the
Something really strange is going on here. I bought a new Mac last week,
I'm trying to wrap my head around using the Web Audio API to recreate
I'm banging my head here. I feel pretty stupid because I'm sure I've done
I have checks in here and if something happens, it will echo a phrase
I scratched my head for two weeks trying to compute something based a variable.
I am breaking my head over this issue. I did find something on the

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.