udfCheckSumMod256
int udfCheckSumMod256 (str)
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfCheckSumMod256 (strString)
If strString == "" Then Return 0
intLen = StrLen (strString)
intSum = 0
For intI = 1 To intLen
   intSum = intSum + Char2Num (StrSub (strString, intI, 1))
Next
Return intSum mod 256
;..........................................................................................................................................
;"MOD256"
; Calculates an 8 bit checksum: Sum on all bytes, modulo 256.
;
; Detlev Dalitz.20090626.
;..........................................................................................................................................
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


; Test.

strString = "Teststring"
intMod256 = udfCheckSumMod256 (strString) ; 55
Message (strString, intMod256 : @LF : "0x" : ChrStringToHex (Num2Char (intMod256)))

strString = "123456789"
intMod256 = udfCheckSumMod256 (strString) ; 221
Message (strString, intMod256 : @LF : "0x" : ChrStringToHex (Num2Char (intMod256)))

Exit