title: new line appending on my encrypted string
body: <p>In Main:</p>
  
  <pre><code>public static void main(String[] args) throws NoSuchAlgorithmException {
      System.out.println("encrypt:" + encryptPassword("superuser")+":" );
  }
  
  public static String encryptPassword(final String password) throws NoSuchAlgorithmException {
      MessageDigest md = MessageDigest.getInstance("MD5");
      byte[] hashPassword = md.digest(password.getBytes());
      String encryPass = Base64.encodeBase64String(hashPassword);
      return encryPass;
  }
  </code></pre>
  
  <p>I'm getting this output:</p>
  
  <pre><code>encrypt:C66i8K4gFQ23j1jN2sRCqQ==:
  </code></pre>
  
  <p>But when I implemented the same thing in my application I'm getting the output below:</p>
  
  <pre><code>encrypt:C66i8K4gFQ23j1jN2sRCqQ==
  :
  </code></pre>
  
  <p><strong>Note:</strong> new line appending on my encrypted string.</p>
  
  <p>application code:</p>
  
  <pre><code>public boolean authenticateUsernamePasswordInternal(UsernamePasswordCredentials credentials) {
      try {
          System.out.println("encrypt:" + getHash("superuser")+":" );
      } catch (Exception e) {
          logger.error(e.getMessage(), e);
          throw new BadCredentialsAuthenticationException(ErrorConstants.CONNECTION_FAILED);
      }
  }
  
  private String getHash(String password) throws NoSuchAlgorithmException, UnsupportedEncodingException{  
      MessageDigest md = MessageDigest.getInstance("MD5");
      byte[] hashPassword = md.digest(password.getBytes());
      String encryPass = Base64.encodeBase64String(hashPassword);
      return encryPass;
  }
  </code></pre>
  
  <p>How I can remove that extra new line.
  why this is happened, please help me <strong>what is the reason?</strong> </p>