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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:55:11+00:00 2026-06-01T15:55:11+00:00

In a BlackBerry application, I am using this code in order to get a

  • 0

In a BlackBerry application, I am using this code in order to get a hash from a password:

        SHA256Digest sha256d = new SHA256Digest();
        byte[] passwordData = null;

        try {
            passwordData = password.getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        DigestOutputStream outputStream = new DigestOutputStream(sha256d, null);
        try {
            outputStream.write(passwordData);
        } catch (IOException e) {
            e.printStackTrace();
        }

        byte[] hashedValue = sha256d.getDigest();
        tempSHA256Password = new String(hashedValue);
        System.out.println(tempSHA256Password);

At the end of this code block, the tempSHA256Password is going to be something that looks like this: ëÇ#ÎiGê8óq =ßÝ÷<rê¨_FR»ã … so in no way what I am expecting. I am expecting a string that looks like this: ebc723ce6947ea38f371a03d0cdfddf73c840f7215eaa85f031446529bbb16e3

What am I doing wrong?

  • 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-01T15:55:13+00:00Added an answer on June 1, 2026 at 3:55 pm

    You can’t print directly a binary value:

    tempSHA256Password = new String(hashedValue);
    System.out.println(tempSHA256Password);
    

    So if you want to convert it to hex you can use this method :

    static final String HEXES = "0123456789ABCDEF";
    public static String getHex( byte [] raw ) {
      if ( raw == null ) {
        return null;
      }
      final StringBuffer hex = new StringBuffer( 2 * raw.length );
      for ( final byte b : raw ) {
        hex.append(HEXES.charAt((b & 0xF0) >> 4))
         .append(HEXES.charAt((b & 0x0F)));
      }
      return hex.toString();
    }
    

    This method comme from here, you have also other example if interested.

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

Sidebar

Related Questions

I am developing a BlackBerry Phonegap application. Therefore, I am using JavaScript. From a
I am using the client side code from http://supportforums.blackberry.com/t5/BlackBerry-Push-Development/Simplified-BIS-Push-client-sample/ta-p/693857 on the BlackBerry Developer Support
I am developing a blackberry application using j2me and LWUIT (blackberry port). Everything works
I am developing blackberry application using BlackBerry JDE 5.0.X , in which i am
I am using Eclipse to develop a Blackberry Java application.Is possible to automatically increment
I am developing a blackberry application and i wanted to access the websites from
I'm new to Blackberry application development and I need a piece of advise. I
i am new in blackberry development. and i have task to develop the application
I developed a Blackberry application using Eclipse. The application is working fine in the
I am using persistent stores to store data in a Blackberry application. While I

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.