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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:02:20+00:00 2026-05-23T15:02:20+00:00

I have a next trouble. In database date storred as md5 from date. When

  • 0

I have a next trouble.
In database date storred as md5 from date. When I make md5 from same date in JAVA i had another hash.
For example: date – 01.02.1980
java hash is addaf0f9a1fb3699871293f888f6e46e (same as oracle md5 hash from string)
oracle hash is DF0919EA828A77DC2CCF68474ED703AC

I tried to repeat oracle result in java:

System.out.println(streamConvertor.getHash("01.02.1980", Boolean.TRUE));
System.out.println("");
System.out.println(streamConvertor.getHash("01.02.1980", Boolean.FALSE));

public String getMD5(String input, Boolean is_date) throws ParseException {
    try {
        MessageDigest md = MessageDigest.getInstance("MD5");
        byte[] mdinput;
        Boolean pr;
        if (input.equals("01.02.1980")) {
            pr = true;
        } else {
            pr = false;
        }

        if (is_date == Boolean.TRUE) {
            SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy");
            Date day = df.parse(input);  
            mdinput = df.format(day).getBytes();
        } else {
            mdinput = input.getBytes();
        }
        if (pr == Boolean.TRUE) {
            System.out.println("Is date " + is_date + " - " + mdinput);
        }
        byte[] messageDigest = md.digest(mdinput);
        if (pr == Boolean.TRUE) {
            System.out.println("message - " + messageDigest);
        }
        BigInteger number = new BigInteger(1, messageDigest);
        if (pr == Boolean.TRUE) {
            System.out.println("Number - " + number);
        }
        String hashtext = number.toString(16);
        // Now we need to zero pad it if you actually want the full 32 chars.
        while (hashtext.length() < 32) {
            hashtext = "0" + hashtext;
        }
        if (pr == Boolean.TRUE) {
            System.out.println("hashtext - " + hashtext);
        }
        return hashtext;
    }
    catch (NoSuchAlgorithmException e) {
        throw new RuntimeException(e);
    }
}

and output is different, but only until byte[] converted to BigInteger:

Is date true - [B@4a65e0
message - [B@665753
Number - 231093251542199165689934828427325924462
hashtext - addaf0f9a1fb3699871293f888f6e46e

Is date false - [B@ef22f8
message - [B@1e0cf70
Number - 231093251542199165689934828427325924462
hashtext - addaf0f9a1fb3699871293f888f6e46e

Is there any possibilities make md5 hash such as in oracle?

  • 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-23T15:02:20+00:00Added an answer on May 23, 2026 at 3:02 pm

    In your comment above, you say the exact expression used in Oracle was:

    DBMS_CRYPTO.hash( UTL_RAW.CAST_TO_RAW( UPPER(to_date('01.02.1980', 'dd.mm.yyyy')) ),2 )
    

    So you take the string ‘01.02.1980’ and convert it to a DATE using an appropriate format. Then you pass the result of that to UPPER(); this will cause the DATE to be implicitly converted to a string, using the default date format for the session. So the result of this expression can potentially be different if it is executed in different environments.

    To try to reproduce the same hash value in Java, use the date format indicated by your NLS_DATE_FORMAT instance parameter. But it is possible that would work for some entries but not others, since the date format used could have varied.

    Basically, you have a very bad bug in the Oracle code that created and stored these hash values. Implicit conversion of a date to a string can be dangerous.

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

Sidebar

Related Questions

I have the next query: var bPermisos = from b in ruc.Permisos where b.IdUsuario
I have next trouble. I have one folder(FirstFolder) and 3 subfolders(1, 2, 3). I
I have trouble with MongoDB on Windows 7 (32 bit). I make some tests
I am having trouble binding some data from my MySQL database to a DataGridView
I have next tables Order , Transaction , Payment . Class Order has some
I'm going to start of by noting that I have next to no python
I have the next function: function setImagesWidth(id,width) { var images = document.getElementById(id).getElementsByTagName(img); for(var i
I have the next query that I run via SQLCMD.EXE use [AxDWH_Central_Reporting] GO EXEC
I have the next code in javascript. I deleted some unnecessary items because it
I have the next problem: I need to process only 1 request at a

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.