This commit is contained in:
mysticbbs 2013-08-17 22:06:11 -04:00
parent b2e89df270
commit a8e615dd49
5 changed files with 55 additions and 44 deletions

View File

@ -66,84 +66,92 @@ Begin
End; End;
Function Digest2String (Digest: String) : String; Function Digest2String (Digest: String) : String;
var Var
count : byte; Count : Byte;
Begin Begin
result := ''; Result := '';
for count := 1 to 16 do For Count := 1 to 16 Do
result := result + byte2hex(byte(digest[count])); Result := Result + Byte2Hex(Byte(Digest[Count]));
result[0] := #32; Result[0] := #32;
End; End;
Function String2Digest (Str: string) : string; Function String2Digest (Str: String) : String;
var Var
count : byte; Count : Byte;
begin Begin
result := ''; Result := '';
count := 1; Count := 1;
while count < length(str) do begin While Count < Length(Str) Do Begin
result := result + char(hextobyte(copy(str, count, 2))); Result := Result + Char(HexToByte(Copy(Str, Count, 2)));
inc (count, 2); Inc (Count, 2);
end; End;
end; End;
procedure MDInit(var MDContext: TMDCtx); Procedure MDInit(var MDContext: TMDCtx);
var Var
n: integer; N: Integer;
begin Begin
MDContext.Count[0] := 0; MDContext.Count[0] := 0;
MDContext.Count[1] := 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; 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.BufLong[n] := 0;
MDContext.State[0] := Integer($67452301); MDContext.State[0] := Integer($67452301);
MDContext.State[1] := Integer($EFCDAB89); MDContext.State[1] := Integer($EFCDAB89);
MDContext.State[2] := Integer($98BADCFE); MDContext.State[2] := Integer($98BADCFE);
MDContext.State[3] := Integer($10325476); MDContext.State[3] := Integer($10325476);
end; End;
procedure ArrLongToByte(var ArLong: Array of Integer; var ArByte: Array of byte); Procedure ArrLongToByte (Var ArLong: Array of Integer; Var ArByte: Array of Byte);
begin Begin
if (High(ArByte) + 1) < ((High(ArLong) + 1) * 4) then If (High(ArByte) + 1) < ((High(ArLong) + 1) * 4) Then
Exit; Exit;
Move (ArLong[0], ArByte[0], High(ArByte) + 1); Move (ArLong[0], ArByte[0], High(ArByte) + 1);
end; End;
procedure ArrByteToLong(var ArByte: Array of byte; var ArLong: Array of Integer); Procedure ArrByteToLong (Var ArByte: Array of Byte; Var ArLong: Array of Integer);
begin Begin
if (High(ArByte) + 1) > ((High(ArLong) + 1) * 4) then if (High(ArByte) + 1) > ((High(ArLong) + 1) * 4) Then
Exit; Exit;
Move (ArByte[0], ArLong[0], High(ArByte) + 1); Move (ArByte[0], ArLong[0], High(ArByte) + 1);
end; End;
procedure MDUpdate(var MDContext: TMDCtx; const Data: string; transform: TMDTransform); Procedure MDUpdate (Var MDContext: TMDCtx; Const Data: String; Transform: TMDTransform);
var Var
Index, partLen, InputLen, I: integer; Index, partLen, InputLen, I: Integer;
begin Begin
InputLen := Length(Data); InputLen := Length(Data);
with MDContext do begin With MDContext do begin
Index := (Count[0] shr 3) and $3F; Index := (Count[0] shr 3) and $3F;
Inc(Count[0], InputLen shl 3); Inc(Count[0], InputLen shl 3);
if Count[0] < (InputLen shl 3) then if Count[0] < (InputLen shl 3) then
Inc(Count[1]); Inc(Count[1]);
Inc(Count[1], InputLen shr 29); Inc(Count[1], InputLen shr 29);
partLen := 64 - Index; partLen := 64 - Index;
if InputLen >= partLen then begin if InputLen >= partLen then begin
ArrLongToByte(BufLong, BufAnsiChar); ArrLongToByte(BufLong, BufAnsiChar);
Move(Data[1], BufAnsiChar[Index], partLen); Move(Data[1], BufAnsiChar[Index], partLen);
ArrByteToLong(BufAnsiChar, BufLong); ArrByteToLong(BufAnsiChar, BufLong);
Transform(State, Buflong); Transform(State, Buflong);
I := partLen; I := partLen;
while I + 63 < InputLen do begin while I + 63 < InputLen do begin

View File

@ -316,7 +316,7 @@ Procedure TOutputCRT.WriteXYPipe (X, Y, Attr, Pad: Integer; Text: String);
Procedure AddChar (Ch: Char); Procedure AddChar (Ch: Char);
Begin Begin
If CursorX > 80 Then Exit; If FCursorX > 80 Then Exit;
Buffer[CursorY][CursorX].Attributes := FTextAttr; Buffer[CursorY][CursorX].Attributes := FTextAttr;
Buffer[CursorY][CursorX].UnicodeChar := Ch; Buffer[CursorY][CursorX].UnicodeChar := Ch;

View File

@ -492,7 +492,7 @@ Begin
If EscapePending Then If EscapePending Then
Goto Escape; Goto Escape;
C := Aport.ReadChar; C := APort.ReadChar;
Case C of Case C of
cXON, cXON,

View File

@ -54,10 +54,10 @@ Const
keyDELETE = #83; keyDELETE = #83;
AppInputSize = 128; AppInputSize = 128;
SDLFontSize : Byte = 24;
SDLFontSpace : Byte = 0;
SDLAppWindowX : Word = 800; SDLAppWindowX : Word = 800;
SDLAppWindowY : Word = 600; SDLAppWindowY : Word = 600;
SDLFontSize : Byte = 17;
SDLFontSpace : Byte = 0;
Type Type
TSDLScreenMode = (mode_80x25, mode_80x50, mode_132x50); TSDLScreenMode = (mode_80x25, mode_80x50, mode_132x50);
@ -154,7 +154,8 @@ Begin
If TTF_Init = -1 Then Halt; 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; If Font = NIL Then Halt;

View File

@ -87,6 +87,8 @@ Var
MyForm : TMenuForm; MyForm : TMenuForm;
Data : Array[1..9] of String; Data : Array[1..9] of String;
Begin Begin
FillChar (Data, SizeOf(Data), #0);
MyBox := TMenuBox.Create(Screen); MyBox := TMenuBox.Create(Screen);
MyForm := TMenuForm.Create(Screen); MyForm := TMenuForm.Create(Screen);