summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-02-20 13:25:27 +0100
committerErich Eckner <git@eckner.net>2018-02-20 13:25:27 +0100
commit251c7a620008edb41be211d3f547dcdab1d85544 (patch)
tree0e36733ca761ffeac5e9df920d27cc785cf69d67
parenta36621ef2dd386586ab60c412ae78d0215ffff41 (diff)
downloadunits-251c7a620008edb41be211d3f547dcdab1d85544.tar.xz
lowlevelunit.pas: pruefSumme neu
-rw-r--r--lowlevelunit.pas10
1 files changed, 10 insertions, 0 deletions
diff --git a/lowlevelunit.pas b/lowlevelunit.pas
index f08a80d..5dcf4aa 100644
--- a/lowlevelunit.pas
+++ b/lowlevelunit.pas
@@ -154,6 +154,7 @@ procedure readAnAndorString(var f: file; out s: string; checkEOL: boolean); over
procedure splitStrToInt(s: string; out ia: tLongintArray);
function vergleicheStrings(s1,s2: string): integer;
+function pruefSumme(s: string; m: longestOrdinal): longestOrdinal; inline;
var
base64Chars: array[0..63] of char;
@@ -1311,6 +1312,15 @@ begin
result:=0;
end;
+function pruefSumme(s: string; m: longestOrdinal): longestOrdinal;
+var
+ i: longint;
+begin
+ result:=0;
+ for i:=1 to length(s) do
+ result:=((result*256)+ord(s[i])) mod m;
+end;
+
var
b: byte;