Messie Kokou

Messie Kokou

  • NA
  • 2
  • 1.2k

code conversion from java to vb.net

Mar 15 2018 11:21 AM
Please help with vb.net version of below method.
 
public static String ValidateTokenSourcePassReq(String scode, String requestID, String spwd)
{
String retVal = null;
try
{
String data = requestID + scode + spwd;
MessageDigest digest = MessageDigest.getInstance("SHA-512");
byte[] hashBytes = data.getBytes("UTF-8");
byte[] messageDigest = digest.digest(hashBytes);
StringBuffer sb = new StringBuffer();
for (int i = 0; i < messageDigest.length; i++)
{
String h = Integer.toHexString(0xFF & messageDigest[i]);
while(h.length() < 2)
h = "0" + h;
sb.append(h);
}
retVal = sb.toString();
}
catch(Exception ex)
{
LoggingUtil.logError(ex);
}
return retVal ;
}
 

Answers (2)