Note that there are some explanatory texts on larger screens.

plurals
  1. POtwo of three byte different in sha256 hash function
    text
    copied!<p>I am using this function to calculate the SHA 256 </p> <pre><code>public static String getSHA1(String plainText) { MessageDigest md; try { md = MessageDigest.getInstance("SHA-256"); md.update(plainText.getBytes(Charset.forName("UTF-8"))); StringBuffer hexString = new StringBuffer(); byte[] bytes = md.digest(); for (int i = 0; i &lt; bytes.length; i++) { hexString.append(Integer.toHexString(0xFF &amp; bytes[i])); } return hexString.toString(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return null; } </code></pre> <p>And to be sure of my results, I check this online website <a href="http://onlinemd5.com/" rel="nofollow">http://onlinemd5.com/</a></p> <p>the results between my code and the online is almost the same, but you know that it must be <code>equal</code>. for instance</p> <h3>my plain testis:</h3> <pre><code>1234567 </code></pre> <h3>the website result</h3> <pre><code>8BB0CF6EB9B17D0F7D22B456F121257DC1254E1F01665370476383EA776DF414 </code></pre> <h3> my code result</h3> <pre><code>8bb0cf6eb9b17df7d22b456f121257dc1254e1f1665370476383ea776df414 </code></pre> <p>and this is more examples:</p> <pre><code>7777777 8C1CDB9CB4DBAC6DBB6EBD118EC8F9523D22E4E4CB8CC9DF5F7E1E499BBA3C10 8c1cdb9cb4dbac6dbb6ebd118ec8f9523d22e4e4cb8cc9df5f7e1e499bba3c10 147258 7A2EC40FF8A1247C532309355F798A779E00ACFF579C63EEC3636FFB2902C1AC 7a2ec4ff8a1247c53239355f798a779e0acff579c63eec3636ffb292c1ac 888888 92925488B28AB12584AC8FCAA8A27A0F497B2C62940C8F4FBC8EF19EBC87C43E 92925488b28ab12584ac8fcaa8a27af497b2c6294c8f4fbc8ef19ebc87c43e </code></pre> <p>I do know that this is <code>maybe</code> about the encoding. but look i used <code>utf-8</code> which is what the website used</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload