473,386 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

LRC Calculation algorithm

Does 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

Jan 9 '06 #1
4 16021
> Does anyone know how to calculate Longitudinal Redundancy Check(LRC) in
VB.NET?


I believe that the lrc byte is just the xor of all the data bytes.

Jan 9 '06 #2
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

Jan 9 '06 #3
"Sankalp" wrote:
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


I don't like this:
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.

Jan 9 '06 #4
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

Jan 9 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Aspersion | last post by:
I'm building an ASP page that has a lot of text and graphics. There is a calculation facility on the page. The user enters several numbers in a form and presses a button to see the calculated...
0
by: anaxamandr | last post by:
Hi. I have a long loop in ASP that performs a rather lengthy calculation. I would love for my users to be able to stop that calculation, if they so choose, mid way through the process. I attempted...
3
by: SSG | last post by:
Hi All! I know how to calculate the running time of a particular routine, but i want to know how to reduce the running time in a program........... can anyone knows help me........ also...
6
by: mail.cordon | last post by:
Hi everyone, I need an algorithm/program that can computer planetory position data for a given date/time/place. Can anyone please help me to find the same (source code/algorithm) or explain me...
4
by: Michiel Alsters | last post by:
Hello everybody, I hope anybody can help me. I'll try to give a brief overview of my problem. I have running a program that performs a heavy calculation. To give the user feedback what the...
9
by: Klaus Bonadt | last post by:
I have found strange behaviour in casting floating point values in C++ 6.0 to int: If I enter in the watch window while debugging in version 6.0 the following term: (1.4 - 1.0) * 10.0 the...
3
by: linq936 | last post by:
I have some algorithm dealing with unsigned int calculation a lot, I am trying to add some check for overflow. The initial thinking was very easy, just do something like this, int...
28
by: beach.dk | last post by:
Hi, I'm trying to implement a simple hash algorith called rs_hash in javascript, but I cannot get a correct result. In c the code looks like this:
2
by: QHorizon | last post by:
Hello, I'm new to Python (I've learned everything up to iterators so far) and fairly new to Programming. This would be my first real program: #Coordinate Geometry (The whole program is not...
5
by: The alMIGHTY N | last post by:
Hi all, Let's say I have a simple math formula: sum (x * y / 1000) / (sum z / 1000) I have to do this across 50 items, each with an x, y and z value, when the page first loads AND when a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.