Code example for MessageDigest

Methods: digest, reset

0
	private static MessageDigest digest;
    public static byte[] getHash(String password) {
    	try{ 
    		if(digest == null)
    			digest = MessageDigest.getInstance("SHA-1");
	        digest.reset();
	        return digest.digest(password.getBytes("UTF-8"));
    	}catch(NoSuchAlgorithmException e){
    		e.printStackTrace();
    	} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		} 
    	 
    	return null; 
  } 
 
	public static Bitmap getFacebookFriendPicture(Long id) {
		try{ 
	    	URL url = new URL("http://graph.facebook.com/"+id+"/picture?width=100&height=100");//type=square");
        	final Bitmap bitmap = BitmapFactory.decodeStream(url.openConnection().getInputStream());
        	return bitmap;