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

  • Home
  • SEARCH
  • 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 6230983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:51:03+00:00 2026-05-24T09:51:03+00:00

I am using java message digest to create MD5 hash, which is used for

  • 0

I am using java message digest to create MD5 hash, which is used for authentication. The MD5 hash is stored in the database as varchar2. I did a test to create a user on my tomcat server on my local laptop. When I deployed the war to the test tomcat server on linux redhat, the authentication failed due to hash unmatched. I checked the user name and password: they are all correct. Both web server points to the same database.

I suspect the hash generated on my local laptop is different from the one generated by the test server. Am I right?

Below is the code with which I generated the hash.

public static String getMD5Hash(String str) throws Exception
{
    MessageDigest md = MessageDigest.getInstance("MD5");

    md.update(str.getBytes());
    return new String(md.digest());
}

The String returned will be saved in the database table, which is defined below

create table authen(
   passport varchar2(50),
   constraint pk_au primary key (passport) USING INDEX TABLESPACE xxxxxxx
);

Here is the java version output on my laptop

C:\Users\XXXX>java -version
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) Client VM (build 20.0-b11, mixed mode, sharing)

Here is the java version output on the redhat server

[xxxxxx@xxxxxxxxx ~]$ java -version
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)
  • 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-24T09:51:03+00:00Added an answer on May 24, 2026 at 9:51 am

    Its possible that you are using the default character set to generate the bytes you are passing into the MD5.digest() method and that character set is different between your laptop and server.

    That could be a reason why you are seeing different results. Otherwise, its not possible for it to generate different results.

    For example —

    byte[] bytesOfMessage = tempStr.getBytes("UTF-8"); // Maybe you're not using a charset here
    MessageDigest md5 = MessageDigest.getInstance("MD5");
    byte[] theDigest = md5.digest(bytesOfMessage);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to publish message on Facebook's fan page using JAVA/GWT API. Any one
I am using http://java.sun.com/jsp/jstl/fmt tag library for outputting messages from Message Resource Bundle which
Using Java, how can I test that a URL is contactable, and returns a
I am using Java back end for creating an XML string which is passed
I am using a java class as a mule endpoint that writes a message
I have this servlet which needs to send mail using Java Mail API, however
i am using a java program which requires a lot of ram. ( Ideally
In http://www.anyexample.com/programming/java/java_simple_class_to_compute_md5_hash.xml an example is given how to calculate an MD5 hash of String.
I am creating a application with chat using java ,mongo database using servlet ,
I am trying to create a simple chat program using Java. I have create

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.