$INCLUDE "QRC4Asm.Inc"
$ESCAPECHARS ON
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"
DECLARE SUB OnClose_frmRc4Test
DECLARE SUB OnClic_AnyMenu (Sender AS QMENUITEM)
CREATE frmRc4Test AS QFORM
Center
Width = 900
height = 800
CAPTION = "frmRc4Test"
AutoScroll = False
OnClose = OnClose_frmRc4Test
CREATE rchWin AS QRICHEDIT
Align = 5
Font.Name = "courier"
Font.Size = 8
Font.COLOR = &H800000
Width = 200
Height = 200
ReadOnly = True
WordWrap = False
ScrollBars = ssBoth
HideSelection = False
PlainText = True
END CREATE
END CREATE
DECLARE FUNCTION SetWindowLong LIB "user32" ALIAS "SetWindowLongA" (hWnd AS LONG, _
nIndex AS LONG, dwNewLong AS LONG) AS LONG
CONST GWL_HWNDPARENT = (-8)
CONST HWND_DESKTOP = 0
setwindowlong(frmRc4Test.handle, GWL_HWNDPARENT, HWND_DESKTOP)
setwindowlong(application.handle, GWL_HWNDPARENT, frmRc4Test.handle)
frmRc4Test.Show
DIM fileIn AS QFILESTREAM
DIM fileOut AS QFILESTREAM
DEFSTR sKey = "My" & CHR$(0) & "Unforgettable" & CHR$(0) & "Key"
DEFSTR TestString_1, TestString_2, ResultString
IF fileIn.OPEN ("MP3Format.Html", fmOpenRead) = 0 THEN SHOWMESSAGE ("Cannot Open RC4Asm.Txt\nI Stop"):END
TestString_1 = fileIn.ReadBinStr(2000) & "\n\nTHIS TEST CUTS THIS FILE AFTER 2000 Characters"
fileIn.CLOSE
TestString_2 = CHR$(0) & "\n\nA NULLCHAR (CHR$(0)) WAS ADDED JUST BEFORE THIS LINE"
DEFSTR sUnderLine = "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" _
& "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
$DEFINE RC4ASM_BINARY_STRINGS
rchWin.AddString( " \n *** TO SHOW YOU THE STRINGS CONTAINING CHR$(0) WE DO A\n\n" _
& " ReplaceSubStr$(ResultString, Chr$(0), \"WXW\") \n\n" _
& " *** BEFORE TO SHOW THESE STRINGS\n" & sUnderLine)
$IFDEF RC4ASM_BINARY_STRINGS
ResultString = TestString_1 & TestString_2
rchWin.AddString(" *** Show ResultString before Crypt : " & sUnderline & REPLACESUBSTR$(ResultString, CHR$(0), "WXW") & sUnderline)
rchWin.Addstring(" *** RC4 easy Encrypt : " & GetRC4AsmErrorByName (Rc4BinStr(ResultString, "Nice Password")))
rchWin.AddString(" *** Show ResultString Crypted : " & sUnderline & REPLACESUBSTR$(ResultString, CHR$(0), "WXW") & sUnderline)
rchWin.Addstring(" *** RC4 easy Decrypt : " & GetRC4AsmErrorByName (Rc4BinStr(ResultString, "Nice Password")))
rchWin.AddString(" *** Show ResultString Decrypted : " & sUnderline & REPLACESUBSTR$(ResultString, CHR$(0), "WXW") & sUnderline)
$ENDIF
$IFDEF RC4ASM_PIPE
DIM sTable AS STRING * 258
rchWin.Addstring(" *** Pipe Init : " & GetRC4AsmErrorByName (Rc4Init(sTable, sKey)))
rchWin.AddString(" *** Show TestString_1 before Crypt : " & sUnderline & REPLACESUBSTR$(TestString_1, CHR$(0), "WXW") & sUnderline)
rchWin.Addstring(" *** Pipe Datas TestString_1 : " & GetRC4AsmErrorByName (RC4Pipe(sTable, TestString_1)))
rchWin.AddString(" *** Show TestString_1 Crypted : " & sUnderline & REPLACESUBSTR$(TestString_1, CHR$(0), "WXW") & sUnderline)
rchWin.AddString(" *** Show TestString_2 before Crypt : " & sUnderline & REPLACESUBSTR$(TestString_2, CHR$(0), "WXW") & sUnderline)
rchWin.Addstring(" *** Pipe Datas TestString_2 : " & GetRC4AsmErrorByName (RC4Pipe(sTable, TestString_2)))
rchWin.AddString(" *** Show TestString_2 Crypted : " & sUnderline & REPLACESUBSTR$ (TestString_2, CHR$(0), "WXW") & sUnderline)
ResultString = TestString_1 & TestString_2
rchWin.AddString(" *** Show ResultString = Crypted(TestString_1) + Crypted(TestString_2) : " & sUnderline & REPLACESUBSTR$(ResultString, CHR$(0), "WXW") & sUnderline)
rchWin.Addstring(" *** Pipe Init : " & GetRC4AsmErrorByName (RC4Init(sTable, sKey)))
rchWin.Addstring(" *** Pipe Datas sTot : " & GetRC4AsmErrorByName (RC4Pipe(sTable, ResultString)))
rchWin.AddString(" *** Show ResultString Decrypted : " & sUnderline & REPLACESUBSTR$(ResultString, CHR$(0), "WXW") & sUnderline)
$ENDIF
$IFDEF RC4ASM_FILE
rchWin.Addstring(" *** Crypting File : " & GetRC4AsmErrorByName (RC4File ("MP3Format.Html", "Mp3Format.HtmlCrypted", sKey, 1000)))
rchWin.Addstring(" *** DeCrypting File : " & GetRC4AsmErrorByName (RC4File ("Mp3Format.HtmlCrypted", "Mp3Format.HtmlDecrypted", sKey, 800)))
$ENDIF
rchWin.Addstring ("\n *** FINISHED ***")
frmRc4Test.Visible = False
frmRc4Test.SHOWMODAL
SUB OnClose_frmRc4Test
Application.Terminate
END
END SUB
|
|