Solved

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

Posted on 2009-05-11
5
1,338 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
Comment Utility
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
Comment Utility
0
 

Author Comment

by:Polors
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks for all, the solution works.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now