Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Fixed by myself! Following function gives same MD5 HASH result:</p> <p>JAVA HASH MD5</p> <pre><code>public static final byte[] md5(String s) { try { MessageDigest md = MessageDigest.getInstance("MD5"); byte[] messageDigest = md.digest(s.getBytes("UTF-8")); String md5 = EncodingUtils.getString(messageDigest, "UTF-8"); Log.i("Function MD5", md5); Log.i("Function MD5 Length","Length: "+ md5.length()); return messageDigest; } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } </code></pre> <p>VB.NET HASH MD5</p> <pre><code>Dim hashmd5 As New MD5CryptoServiceProvider() pwdhash = hashmd5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(key)) </code></pre> <p>And, TRIPLE-DES ECB JAVA is</p> <pre><code>try { Cipher cipher = Cipher.getInstance("DESEDE/ECB/PKCS5Padding"); SecretKeySpec myKey = new SecretKeySpec(hash,"DESede"); cipher.init(Cipher.ENCRYPT_MODE, myKey); try { byte[] encryptedPlainText = cipher.doFinal(plaintextByte); encrypted = Base64.encodeToString(encryptedPlainText, 0); Log.i("ENCRYPT", "Pwd encrypted: "+encrypted); return encrypted; } catch (IllegalBlockSizeException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (BadPaddingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchPaddingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvalidKeyException e) { // TODO Auto-generated catch block e.printStackTrace(); } </code></pre> <p>TRIPLE-DES VB.NET is</p> <pre><code>' Create a new TripleDES service provider Dim tdesProvider As New TripleDESCryptoServiceProvider() tdesProvider.Key = pwdhash tdesProvider.Mode = CipherMode.ECB encrypted = Convert.ToBase64String(tdesProvider.CreateEncryptor().TransformFinalBlock(inputBytes, 0, inputBytes.Length)) </code></pre>
 

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