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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:27:39+00:00 2026-06-04T20:27:39+00:00

Here I attach my code regards SHA-1 algorithm based Java code for same input

  • 0

Here I attach my code regards “SHA-1” algorithm based Java code for same input value given manually:

import java.security.MessageDigest;    
import java.security.NoSuchAlgorithmException;    
import sun.misc.BASE64Encoder;

public class NewClass {       
 public static void main(String args[]) throws NoSuchAlgorithmException        
 {       
    MessageDigest digest = MessageDigest.getInstance("SHA-1");    
    System.out.println("Algorithm :"+digest.getAlgorithm());    
    digest.update("welcome".getBytes());    
    byte[] result = digest.digest();     
    hash = (new BASE64Encoder()).encode(result);     
    MessageDigest digest1 = MessageDigest.getInstance("SHA-1");    
    digest1.update("welcome".getBytes());    
    byte[] result1 = digest1.digest();    
    System.out.println(result);    
    System.out.println(result1);    
    String hash1 = (new BASE64Encoder()).encode(result);    
    System.out.println("Digest value"+hash);    
    System.out.println("Digest value"+hash1);       
 }

}

output:

Algorithm :SHA-1

[B@42e816

[B@9304b1

Digest value wLE3/i15JFnyb/djzORFdKW1qwM=

Digest value wLE3/i15JFnyb/djzORFdKW1qwM=

The above algorithm produces the same hash code, but the intermediate values are not same. Why is that?

  • 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-04T20:27:41+00:00Added an answer on June 4, 2026 at 8:27 pm

    [B@42e816 is what you get when you try to print an array in Java. It just prints its memory address, not the contents. Obviously, two different arrays will have different addresses.

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

Sidebar

Related Questions

The following Java code is used to attach a file to an email. I
Here is the code I use to attach the div: $(#sessions).prepend(tempct); $(#sessions>div:first-child).hide().slideDown(1000).delay(100,function(){ $(#sessions>div:first-child).click(); $(#renamemeeting).click();
here i attach a sample code. they used JavaScriptSerializer to generate data in json
here is my php code $titikPetaInti = array(); while($row = mysql_fetch_assoc($hasil2)) { $titikPetaInti[] =
Here's a piece of code I copied from http://www.schillmania.com/content/projects/javascript-animation-1/demo/ Very simple JS animation: function
Here is the code I'm using inside my AsyncTask DefaultHttpClient httpClient = new DefaultHttpClient();
Here is a code snippet I was working with: int *a; int p =
Here is my program to find all the subsets of given set. To solve
here's my code private void make_Book(int x, int y, string name) { #region Creating
Here is my code: #Make the SOAP connection url = https://api.channeladvisor.com/ChannelAdvisorAPI/v1/InventoryService.asmx?WSDL headers = {'Content-Type':

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.