Is this the correct way to create a one byte LRC
Code: Select all
function MyLRC(text)
local ret:=left(text,1),x
for x = 2 to len(text)
ret:=chr(nXor( asc(ret), Asc(substr(text,x,1) ) ) )
next
return ret
Code: Select all
function MyLRC(text)
local ret:=left(text,1),x
for x = 2 to len(text)
ret:=chr(nXor( asc(ret), Asc(substr(text,x,1) ) ) )
next
return ret
Code: Select all
function LRC( cText )
local nCheckSum := 0
local n
for n = 1 to Len( cText )
nCheckSum = nXor( nCheckSum, Asc( SubStr( cText, n, 1 ) ) )
next
return nCheckSum