Solved

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

Posted on 2009-05-11
5
1,398 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

696 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