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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:20:32+00:00 2026-06-07T12:20:32+00:00

When comparing passwords, there is always an issue of keeping them in memory. Instead,

  • 0

When comparing passwords, there is always an issue of keeping them in memory. Instead, the moment a password is introduced, i’d like to replace it with its md5 snapshot (or any other hash producing function)

Assuming you have a Key Value pair String password = "Secret";, what is the simplest way to scramble “secret” to something unique?

  • 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-07T12:20:33+00:00Added an answer on June 7, 2026 at 12:20 pm

    Use a MessageDigest. Something like this:

    MessageDigest algorithm = MessageDigest.getInstance("MD5");
    algorithm.reset();
    algorithm.update(password.getBytes());
    byte bytes[] = algorithm.digest();
    StringBuffer sb = new StringBuffer();
    for (byte b : bytes) {
        String hex = Integer.toHexString(0xff & b);
        if(hex.length() == 1)
            sb.append('0');
        sb.append(hex);
    }
    result = sb.toString();
    

    Also, watch out of the NoSuchAlgorithmException that can be thrown by the getInstance method if the MD5 algorithm is somehow not available.

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

Sidebar

Related Questions

When comparing a tuple with a list like ... >>> [1,2,3] == (1,2,3) False
I need help with comparing a column to a string. There is a column
Short of recursing and comparing dates of files/directories, is there a better way of
Possible duplicate : comparing-two-arrays I have two NSArray and I'd like to create a
I have set compare attribute for comparing passwords as explained in this blog. But
In my 'Members' model, I am comparing whether password matches password_confirm through this custom
I have a login box using a simple javascript login comparing usernames and passwords,
I have to do the decryption before comparing the password. I have not used
When comparing a string literal with another string literal with the == operator (or
Why comparing to null is so unstable? Just code. IronRuby 0.9.4.0 on .NET 2.0.50727.4927

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.