I have samll doubt in SHA 256 algorith, Using sha256 alogorith i write a smalll java program that will generate 30 charecters of hash value for my given string, But when i ran same program on linux(64 bit ) os. I am getting 70 charecter of hash value. do you have any idea
i am giving my code here
import java.io.*;
import sun.misc.*;
import org.apache.commons.codec.binary.*;
import java.security.MessageDigest;
import java.net.URLEncoder;

import com.sun.org.apache.xerces.internal.impl.dv.util.Ba se64;

class SHA256

public static void main(String args[]) throws Exception

String msisdn = "7950977702";
//Performing SHA256
byte[] encoded = null;
String sha256EncodedString = null;
MessageDigest md = MessageDigest.getInstance("SHA-1");
encoded = md.digest(msisdn.getBytes());
System.out.println("sha value: " + encoded);
sha256EncodedString = new String(encoded);
System.out.println("\nEncoded sha 256 value: " + sha256EncodedString);

String bytesToBase64String = null;
bytesToBase64String = Base64.encode(sha256EncodedString.getBytes());
System.out.println("\nAfter encoding using Apache xerces encoding SHA256/BASE64 :"+ bytesToBase64String.trim());
bytesToBase64String = bytesToBase64String.substring(0, bytesToBase64String.indexOf("="));
System.out.println("\nAfter encoding using Apache xerces encoding/paddding SHA256/BASE64 :"+ bytesToBase64String.trim());

org.apache.commons.codec.binary.Base64 base64 = new org.apache.commons.codec.binary.Base64();
String baseEncode = base64.encode(sha256EncodedString.getBytes()).toSt ring();
System.out.println("\nAfter encoding using Apache encoding SHA256/BASE64 :"+ baseEncode.trim());

BASE64Encoder encoder = new BASE64Encoder();
String sunBaseEncode = encoder.encodeBuffer(sha256EncodedString.getBytes( ));
System.out.println("\nAfter encoding using suns encoding SHA256/BASE64 :"+ sunBaseEncode.trim());

} catch (Exception e)
System.out.println("Exception " + e);