Sub OTPGenerator(uniqueIdentity As String) As String
Dim oneTimePassword As String =""
Try
Dim length As Int=5
Dim bc As ByteConverter
Dim b64 As Base64
Dim md As MessageDigest
Dim data() As Byte
Dim encrypted() As Byte
data = bc.StringToBytes(uniqueIdentity, "utf-8")
encrypted = md.GetMessageDigest(data, "MD5")
Dim parsedReqNo As Int= bc.IntsFromBytes(encrypted)
Dim strParsedReqId As String = Abs(parsedReqNo)
If strParsedReqId.Length < 9 Then
Dim sb As String = strParsedReqId
For k = 0 To 9 - strParsedReqId.Length - 1
sb="0" & sb 'sb.Insert(0, "0"c)
Next
strParsedReqId = sb
End If
oneTimePassword = strParsedReqId
Log(oneTimePassword)
Log(b64.EncodeBtoS(encrypted, 0, encrypted.Length))
If oneTimePassword.Length >= length Then
oneTimePassword = oneTimePassword.Substring2(0, length)
End If
Catch
Log(LastException)
End Try
Return oneTimePassword
End Sub