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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:57:52+00:00 2026-06-14T13:57:52+00:00

On client side I am doing an MD5 encryption of a string and then

  • 0

On client side I am doing an MD5 encryption of a string and then a BASE 64 encoding on the hash generated.

This final encoded string is then used for comparison on server side.

I was able to do this successfully for many test cases but it failed for the below one.

String for MD5

  2679:07071960:09348448:3:08912206:3:EXPRESS:1:EU4NW31E7INEC1X

My MD5 hash string:

  291423A531148527A9524EA0924CDF68

My Base64 encoded string:

  KRQjpTEUhSepUk6gkkzfaA==

When I try to put the MD5 hash string for BASE64 encoding on http://www.opinionatedgeek.com/dotnet/tools/base64encode/ it generates following string:

  MjkxNDIzQTUzMTE0ODUyN0E5NTI0RUEwOTI0Q0RGNjg=

But, when I try to decode my Base64 string, that is “KRQjpTEUhSepUk6gkkzfaA==”, here http://www.opinionatedgeek.com/dotnet/tools/Base64Decode/Default.aspx I am getting my Hash Code(opened the .bin file being generated in hex editor).

So, is it possible that a single string may have multiple Base64 encoded value?

I am using the below code for generating the encoded string:

  public static String getHashCode(String text) 
 { 
    MessageDigest md;
    byte[] md5hash = new byte[32];
    try{
    md = MessageDigest.getInstance("MD5");

    md.update(text.getBytes("iso-8859-1"), 0, text.length());
    md5hash = md.digest();
    }
    catch(Exception e)
    {
        return "-1";
        }
    String encoded = Base64.encode(md5hash);
    String retValue = new String(encoded);


    return retValue;

   } 

Kindly, suggest what is going wrong and how to make sure that we use same digest both on client and server side.

  • 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-14T13:57:53+00:00Added an answer on June 14, 2026 at 1:57 pm

    You have the MD5 Hash 291423A531148527A9524EA0924CDF68 that generates the Base64 encoded string MjkxNDIzQTUzMTE0ODUyN0E5NTI0RUEwOTI0Q0RGNjg= , which is fine. You have converted the MD5 hash to an ascii hex representation, and base64 encoded that.

    However your own getHashCode() works differently, it creates a base64 encoding of the binary representation of your hash code, you have not converted your hash to an ascii hex representation, and that’s why you see different base64 encoded strings.

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

Sidebar

Related Questions

I am doing some client side validation in ASP.NET MVC and I found myself
I have an ASP.NET MVC 2 form that is working perfectly, doing client side
I'm doing some simple client side validation with jQuery. var passedValidation = new Boolean(true);
I have been doing more client-side development, managing the UI on the client and
Update: this question is specifically about protecting (encipher / obfuscate) the content client side
I really like the idea of validating forms client-side before doing so server-side. If
I am doing client side testing for my web application using IE only, there
I am doing client side testing for my web application using IE only, there
I am currently doing a client-side redirect to get from a legacy servlet (old
I'm working on the client side application of the client/server chat I'm doing for

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.