?
Solved

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

Posted on 2009-05-11
5
Medium Priority
?
1,415 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 200 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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

762 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