I am trying to use some VB6 code in a .net app. It uses a function AscB which is no longer availiable. What would I need to use in .net?
Extract of how the function is used (function in third line from end)….
' Combine each block of 4 bytes (ascii code of character) into one long
' value and store in the message. The high-order (most significant) bit of
' each byte is listed first. However, the low-order (least significant) byte
' is given first in each word.
lBytePosition = 0
lByteCount = 0
Do Until lByteCount >= lMessageLength
' Each word is 4 bytes
lWordCount = lByteCount \ BYTES_TO_A_WORD
' The bytes are put in the word from the right most edge
lBytePosition = (lByteCount Mod BYTES_TO_A_WORD) * BITS_TO_A_BYTE
lWordArray(lWordCount) = lWordArray(lWordCount) Or _
LShift(AscB(Mid(sMessage, lByteCount + 1, 1)), lBytePosition)
lByteCount = lByteCount + 1
Loop
Thanks
Gent, many thanks for your replies… The code I had was part of an MD5 encryption class written in VB6. Over the weekend I came across a .net class I was unaware of… System.Security.Cryptography which gave me the encryption I needed in 5 lines of code instead of the 100+ lines of VB6 code. Many thanks for your efforts.
BTW both your answers worked. Albeit I needed to tweak the VB6 code a bit more.