|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
LRC Calculation algorithmDoes anyone know how to calculate Longitudinal Redundancy Check(LRC) in
VB.NET? I am trying to send Visa-II formatted even parity message to a credit card processor and am not sure how to calculate the LRC which needs to be appended to the message. Any pointers would be most helpful. Thanks in advance. Sankalp > Does anyone know how to calculate Longitudinal Redundancy Check(LRC) in I believe that the lrc byte is just the xor of all the data bytes.> VB.NET? Here is the code that I am using:
GenerateMessageETX() - This function returns the credit card data and the ETX chanracter in the string format. Then I create an HTTPWebRequest to the credit card payment gateway. Dim message As String = pageData Dim j As Integer Dim LRC As Byte = "0" For j = 0 To message.Length - 1 Dim chr As Char = message.Substring(j, 1) LRC = LRC Xor Convert.ToByte(chr) Next Is this the LRC value or do i need to do something else. Please guide-have been stuck in this for some time now. Sankalp "Sankalp" wrote: I don't like this:> Dim message As String = pageData > Dim j As Integer > Dim LRC As Byte = "0" > For j = 0 To message.Length - 1 > Dim chr As Char = message.Substring(j, 1) > LRC = LRC Xor Convert.ToByte(chr) > Next Dim LRC As Byte = "0" It probably gives a compiler error. I would code like this: Dim message As String = pageData Dim lrc As Integer = 0 For j As Integer = 0 To message.Length - 1 lrc = lrc Xor AscW(message.Chars(j)) Next At this point, my guess is that you should transmit this string: message & Chr(lrc) It is your pageData string with one lrc byte appended. Thanks A, tried this but doesnt work. Now I am beginning to doubt the
servers as well. They have given us 2 servers to test with one being the backup server. But, both the servers are returning different responses to the same message. I guess i will have to verify this with the company. Thanks for your help again :-) Sankalp
VS.NET 2005 hotfixes?
Send E-Mail from VB.Net 2003 number of lines in Richtextbox Refresh Data Sending mail ftp callback example C# Bind dinamicly dlls without createobject sending Fax from vb.net with Microsoft Fax Service Extended COM Type Libary Movement of record Strange Results From FillEllipse |
|||||||||||||||||||||||