Solved

Anybody, can help me calculate the LRC and VRC for strings in Delphi Programming

Posted on 2009-05-11
5
1,373 Views
Last Modified: 2012-05-06
I want to find the delphi code to solve the LRC and VRC method for strings

Thanks
0
Comment
Question by:Polors
5 Comments
 
LVL 5

Expert Comment

by:wd123
ID: 24359118
i think something like this
function LRC(s:string):char;
var i:integer;
    res:char;
begin
res:=#0;
for I:=1 to length(s) do res:=chr(ord(res) xor ord(s[i]));
result:=res;
end;

Open in new window

0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 24365493
0
 

Author Comment

by:Polors
ID: 24365986
I reviewed the link, I think that is the solution to CRC16 and CR32 algorithm, but the functions LRC and VRC works with only that code?
Thanks !!!
0
 
LVL 26

Accepted Solution

by:
Russell Libby earned 50 total points
ID: 24368415
Non assembler versions. (both are trivial routines).

function Vrc(S: String): Byte;
var  i:             Integer;
begin

  // Default result
  result:=0;

  // Walk the string
  for i:=1 to Length(S) do
  begin
     Inc(result, Ord(S[i]));
  end;

end;

function Lrc(S: String): Byte;
var  i:             Integer;
begin

  // Default result
  result:=0;

  // Walk the string
  for i:=1 to Length(S) do
  begin
     result:=result xor Ord(S[i]);
  end;

end;
0
 

Author Closing Comment

by:Polors
ID: 31580293
Thanks for all, the solution works.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Okay. So what exactly is the problem here? How often have we come across situations where we need to know if two strings are 'similar' but not necessarily the same? I have, plenty of times. Until recently, I thought any functionality like that wo…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question