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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:17:57+00:00 2026-05-18T06:17:57+00:00

I want to compute Hash of a String, but the Hash value should be

  • 0

I want to compute Hash of a String, but the Hash value should be a number (long or integer).

In other words I want to compute integer hash of a string.
Collusion resistance in not the concern.

Is there an way to convert MessageDigest of SHA-256 to a number.

I am using Java to accomplish this.

  • 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-18T06:17:57+00:00Added an answer on May 18, 2026 at 6:17 am

    A Sha Hash has 256 Bits e.g.

    "364b7e70a9966ef7686ab814958cd0017b7f19147a257d40603d4a1307662b42"
    

    this will exceed the range of long and integer.
    You could use new BigInteger( hash, 16 ); for a decimal representation.

    public static void main(String[] args) throws NoSuchAlgorithmException {
            MessageDigest digest = MessageDigest.getInstance("SHA-256");
            digest.update("string".getBytes() );
            byte[] hash = digest.digest();
            BigInteger bi = new BigInteger( hash );
            System.out.println( "hex:" + bi.toString(16) + "\r\ndec:" + bi.toString() );
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to compute an md5 hash not of a string, but of an
May be it sound dumb but if I want some computed value from other
I want to generate the hash code from a string,e.g.咖啡,but the hashcode I get
I want to compute covariance using PDL , but the problem is that it
I need to compute MD5 hash of a String and googling I found this
Possible Duplicate: Generate MD5 hash in Java Hi, I want to compute the MD5
I have some problems with the SHA1 hash value of a string. I'm trying
I'm writing a little utility in cocoa to compute MD5, SHA-1, and other hash
I want to compute the time 4 hours later during the DST transition, either
For use in a rigid body simulation, I want to compute the mass and

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.