Solved

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

Posted on 2009-05-11
1,338 Views
I want to find the delphi code to solve the LRC and VRC method for strings

Thanks
0
Question by:Polors

LVL 5

Expert Comment

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;
``````
0

LVL 26

Expert Comment

0

Author Comment

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

Russell Libby earned 50 total points
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

Thanks for all, the solution works.
0

## Featured Post

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
The greatest common divisor (gcd) of two positive integers is their largest common divisor. Let's consider two numbers 12 and 20. The divisors of 12 are 1, 2, 3, 4, 6, 12 The divisors of 20 are 1, 2, 4, 5, 10 20 The highest number among the c…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

#### Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!