From a8e615dd4948411cefb65da8e2d607ffbb0c7748 Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Sat, 17 Aug 2013 22:06:11 -0400 Subject: [PATCH] A37 --- mdl/m_crypt.pas | 86 +++++++++++++++++++++++-------------------- mdl/m_output_crt.pas | 2 +- mdl/m_prot_zmodem.pas | 2 +- mdl/m_sdlcrt.pas | 7 ++-- mdl/mdltest2.pas | 2 + 5 files changed, 55 insertions(+), 44 deletions(-) diff --git a/mdl/m_crypt.pas b/mdl/m_crypt.pas index c5a7592..08dca37 100644 --- a/mdl/m_crypt.pas +++ b/mdl/m_crypt.pas @@ -66,84 +66,92 @@ Begin End; Function Digest2String (Digest: String) : String; -var - count : byte; +Var + Count : Byte; Begin - result := ''; + Result := ''; - for count := 1 to 16 do - result := result + byte2hex(byte(digest[count])); + For Count := 1 to 16 Do + Result := Result + Byte2Hex(Byte(Digest[Count])); - result[0] := #32; + Result[0] := #32; End; -Function String2Digest (Str: string) : string; -var - count : byte; -begin - result := ''; - count := 1; +Function String2Digest (Str: String) : String; +Var + Count : Byte; +Begin + Result := ''; + Count := 1; - while count < length(str) do begin - result := result + char(hextobyte(copy(str, count, 2))); - inc (count, 2); - end; -end; + While Count < Length(Str) Do Begin + Result := Result + Char(HexToByte(Copy(Str, Count, 2))); + Inc (Count, 2); + End; +End; -procedure MDInit(var MDContext: TMDCtx); -var - n: integer; -begin +Procedure MDInit(var MDContext: TMDCtx); +Var + N: Integer; +Begin MDContext.Count[0] := 0; MDContext.Count[1] := 0; - for n := 0 to high(MDContext.BufAnsiChar) do + For N := 0 to High(MDContext.BufAnsiChar) Do MDContext.BufAnsiChar[n] := 0; - for n := 0 to high(MDContext.BufLong) do + For N := 0 to High(MDContext.BufLong) Do MDContext.BufLong[n] := 0; MDContext.State[0] := Integer($67452301); MDContext.State[1] := Integer($EFCDAB89); MDContext.State[2] := Integer($98BADCFE); MDContext.State[3] := Integer($10325476); -end; +End; -procedure ArrLongToByte(var ArLong: Array of Integer; var ArByte: Array of byte); -begin - if (High(ArByte) + 1) < ((High(ArLong) + 1) * 4) then +Procedure ArrLongToByte (Var ArLong: Array of Integer; Var ArByte: Array of Byte); +Begin + If (High(ArByte) + 1) < ((High(ArLong) + 1) * 4) Then Exit; - Move(ArLong[0], ArByte[0], High(ArByte) + 1); -end; + Move (ArLong[0], ArByte[0], High(ArByte) + 1); +End; -procedure ArrByteToLong(var ArByte: Array of byte; var ArLong: Array of Integer); -begin - if (High(ArByte) + 1) > ((High(ArLong) + 1) * 4) then +Procedure ArrByteToLong (Var ArByte: Array of Byte; Var ArLong: Array of Integer); +Begin + if (High(ArByte) + 1) > ((High(ArLong) + 1) * 4) Then Exit; - Move(ArByte[0], ArLong[0], High(ArByte) + 1); -end; + Move (ArByte[0], ArLong[0], High(ArByte) + 1); +End; -procedure MDUpdate(var MDContext: TMDCtx; const Data: string; transform: TMDTransform); -var - Index, partLen, InputLen, I: integer; -begin +Procedure MDUpdate (Var MDContext: TMDCtx; Const Data: String; Transform: TMDTransform); +Var + Index, partLen, InputLen, I: Integer; +Begin InputLen := Length(Data); - with MDContext do begin + With MDContext do begin Index := (Count[0] shr 3) and $3F; + Inc(Count[0], InputLen shl 3); + if Count[0] < (InputLen shl 3) then Inc(Count[1]); + Inc(Count[1], InputLen shr 29); + partLen := 64 - Index; if InputLen >= partLen then begin ArrLongToByte(BufLong, BufAnsiChar); + Move(Data[1], BufAnsiChar[Index], partLen); + ArrByteToLong(BufAnsiChar, BufLong); + Transform(State, Buflong); + I := partLen; while I + 63 < InputLen do begin diff --git a/mdl/m_output_crt.pas b/mdl/m_output_crt.pas index 6a1bbf8..057122c 100644 --- a/mdl/m_output_crt.pas +++ b/mdl/m_output_crt.pas @@ -316,7 +316,7 @@ Procedure TOutputCRT.WriteXYPipe (X, Y, Attr, Pad: Integer; Text: String); Procedure AddChar (Ch: Char); Begin - If CursorX > 80 Then Exit; + If FCursorX > 80 Then Exit; Buffer[CursorY][CursorX].Attributes := FTextAttr; Buffer[CursorY][CursorX].UnicodeChar := Ch; diff --git a/mdl/m_prot_zmodem.pas b/mdl/m_prot_zmodem.pas index 375a7bc..0662599 100644 --- a/mdl/m_prot_zmodem.pas +++ b/mdl/m_prot_zmodem.pas @@ -492,7 +492,7 @@ Begin If EscapePending Then Goto Escape; - C := Aport.ReadChar; + C := APort.ReadChar; Case C of cXON, diff --git a/mdl/m_sdlcrt.pas b/mdl/m_sdlcrt.pas index 7aa1b73..939bea0 100644 --- a/mdl/m_sdlcrt.pas +++ b/mdl/m_sdlcrt.pas @@ -54,10 +54,10 @@ Const keyDELETE = #83; AppInputSize = 128; + SDLFontSize : Byte = 24; + SDLFontSpace : Byte = 0; SDLAppWindowX : Word = 800; SDLAppWindowY : Word = 600; - SDLFontSize : Byte = 17; - SDLFontSpace : Byte = 0; Type TSDLScreenMode = (mode_80x25, mode_80x50, mode_132x50); @@ -154,7 +154,8 @@ Begin If TTF_Init = -1 Then Halt; - Font := TTF_OpenFont('ASCII.ttf', SDLFontSize); +// Font := TTF_OpenFont('ASCII.ttf', SDLFontSize); + Font := TTF_OpenFont('\dev\sdl\Perfect DOS VGA 437.ttf', SDLFontSize); If Font = NIL Then Halt; diff --git a/mdl/mdltest2.pas b/mdl/mdltest2.pas index a53b543..aed0dc8 100644 --- a/mdl/mdltest2.pas +++ b/mdl/mdltest2.pas @@ -87,6 +87,8 @@ Var MyForm : TMenuForm; Data : Array[1..9] of String; Begin + FillChar (Data, SizeOf(Data), #0); + MyBox := TMenuBox.Create(Screen); MyForm := TMenuForm.Create(Screen);