|
You last visited: Today at 22:52
Advertisement
Autoit Dateien Verschlüsseln und Entschlüsseln?
Discussion on Autoit Dateien Verschlüsseln und Entschlüsseln? within the AutoIt forum part of the Coders Den category.
01/25/2010, 21:15
|
#1
|
elite*gold: 8
Join Date: Apr 2009
Posts: 2,977
Received Thanks: 855
|
Autoit Dateien Verschlüsseln und Entschlüsseln?
Abend!
Ist es irgendwie möglich in AutoIT einen Text zu Verschlüsseln der nicht über den Editor zu berarbeiten ist aber dennoch später wieder mit AutoIT zu Entschlüsseln.Möchte damit eine "Speicherdatei" anlegen aber da man dan diese Datei mit Editor o.ä Ändern könnte das man z.b statt normalerweise Level 2, Level 99 hinschreibt ist das auch blöd sonst würde ich es ja über eine .ini Datei machen.
Hoffe ihr könnt mir helfen
|
|
|
01/25/2010, 21:19
|
#2
|
elite*gold: 77
Join Date: May 2008
Posts: 5,430
Received Thanks: 5,876
|
Quote:
Originally Posted by masterakio1995
Abend!
Ist es irgendwie möglich in AutoIT einen Text zu Verschlüsseln der nicht über den Editor zu berarbeiten ist aber dennoch später wieder mit AutoIT zu Entschlüsseln.Möchte damit eine "Speicherdatei" anlegen aber da man dan diese Datei mit Editor o.ä Ändern könnte das man z.b statt normalerweise Level 2, Level 99 hinschreibt ist das auch blöd sonst würde ich es ja über eine .ini Datei machen.
Hoffe ihr könnt mir helfen
|
Das hatte ich noch übrig , könnte dir helfen :
PHP Code:
#include <File.au3> #include <String.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GuiComboBox.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Verschlüsselung/Entschlüsselung", 406, 140, 192, 124, Default, $WS_EX_ACCEPTFILES) $Input1 = GUICtrlCreateInput("", 8, 8, 393, 21) GUICtrlSetState($Input1, $GUI_DROPACCEPTED) $Encrypt = GUICtrlCreateButton("Encrypt", 136, 40, 129, 33, $WS_GROUP) $Search = GUICtrlCreateButton("Search", 8, 40, 121, 33, $WS_GROUP) $Decrypt = GUICtrlCreateButton("Decrypt", 272, 40, 129, 33, $WS_GROUP) $Input2 = GUICtrlCreateInput("Key", 8, 80, 393, 21,$ES_PASSWORD) $Combo1 = GUICtrlCreateCombo("", 8, 110, 393, 21) GUICtrlSetData($Combo1,"XXTEA|RC4|XXTEA & RC4") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### _GUICtrlComboBox_SetCurSel($Combo1,2) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Input1 Case $Encrypt If GUICtrlRead($Input1)<>"" Then Start(1) EndIf Case $Search Global $file2=FileOpenDialog("File","Öffnen","(*.txt)") GUICtrlSetData($Input1,$file2) Case $Decrypt If GUICtrlRead($Input1)<>"" Then Start(0) endif EndSwitch WEnd Func Start($encrypt) $file2=GUICtrlRead($Input1) $Key=GUICtrlRead($Input2) $file=InputBox("Filename","Filename")&".txt" FileClose($file2) $hFile=FileOpen($file2,16) Global $sText=FileRead($hFile) $sel=_GUICtrlComboBox_GetCurSel($Combo1) If $encrypt=1 Then If $sel=0 or $sel=2 Then $sText=_XXTEA_Encrypt($sText, $Key) EndIf If $sel=1 or $sel=2 Then $sText=_RC4($sText, $Key) EndIf Else If $sel=1 or $sel=2 Then $sText=_RC4($sText, $Key) EndIf If $sel=0 or $sel=2 Then $sText=_XXTEA_Decrypt($sText, $Key) EndIf EndIf _FileCreate($file) FileClose($file) $hFile=FileOpen($file,2) FileWrite($hFile,$sText) FileClose($hFile) EndFunc Func _XXTEA_Encrypt($Data, $Key) $Data = Binary($Data) Local $DataLen = BinaryLen($Data) If $DataLen = 0 Then Return "" ElseIf $DataLen < 8 Then $DataLen = 8 EndIf Local $Opcode = '0x83EC14B83400000099538B5C2420558B6C242056578B7C9DFCF7FB89C683C606C74424180000000085F68D76FF0F8EEA000000896C24288D4BFF8D549D00894C2410895424148974242081442418B979379E8B4C2418C1E90281E103000000894C241C31F6397424107E568B5424288BCF8B6CB204C1E9058D14AD0000000033CA8BD58BC7C1EA03C1E00433D003CA8B5424188BDE81E303000000335C241C8B4424308B1C9833D533DF03D333CA8B542428010CB28B0CB2463974241089CF7FAA8B5424288BCF8B2AC1E9058D14AD0000000033CA8BD58BC7C1EA03C1E00433D003CA8B5424188BDE81E303000000335C241C8B4424308B1C9833D533DF03D3FF4C242033CA8B542414014AFC8B4AFC8B54242089CF420F8F2DFFFFFF5F31C05E5D5B83C414C21000' Local $CodeBuffer = DllStructCreate("byte[" & BinaryLen($Opcode) & "]") DllStructSetData($CodeBuffer, 1, $Opcode) Local $V = DllStructCreate("byte[" & Ceiling($DataLen / 4) * 4 & "]") DllStructSetData($V, 1, $Data) Local $K = DllStructCreate("byte[16]") DllStructSetData($K, 1, $Key) DllCall("user32.dll", "none", "CallWindowProc", "ptr", DllStructGetPtr($CodeBuffer), _ "ptr", DllStructGetPtr($V), _ "int", Ceiling($DataLen / 4), _ "ptr", DllStructGetPtr($K), _ "int", 0) Local $Ret = DllStructGetData($V, 1) $CodeBuffer = 0 $V = 0 $K = 0 Return $Ret EndFunc Func _XXTEA_Decrypt($Data, $Key) $Data = Binary($Data) Local $DataLen = BinaryLen($Data) If $DataLen = 0 Then Return "" Local $Opcode = '0x83EC10B83400000099538B5C241C55568B742420578B3EF7FB69D0B979379E81C256DA4CB5895424180F84DD000000897424248D4BFF8D149E894C2410895424148B4C2418C1E90281E103000000894C241C8B742410837C2410007E528B5424248B6CB2FC8BCD8BD7C1E905C1E20233CA8BD78BC5C1EA03C1E00433D003CA8B5424188BDE81E3030000008B44242C33D7335C241C8B1C9833DD03D333CA8B542424290CB28B0CB24E89CF85F67FAE8B5424148B6AFC8BCD8BD7C1E905C1E20233CA8BD78BC5C1EA03C1E00433D003CA8B5424188BDE81E3030000008B44242C33D7335C241C8B1C9833DD03D333CA8B542424290A8B0A89CF814424184786C861837C2418000F8535FFFFFF5F31C05E5D5B83C410C21000' Local $CodeBuffer = DllStructCreate("byte[" & BinaryLen($Opcode) & "]") DllStructSetData($CodeBuffer, 1, $Opcode) Local $V = DllStructCreate("byte[" & Ceiling($DataLen / 4) * 4 & "]") DllStructSetData($V, 1, $Data) Local $K = DllStructCreate("byte[16]") DllStructSetData($K, 1, $Key) DllCall("user32.dll", "none", "CallWindowProc", "ptr", DllStructGetPtr($CodeBuffer), _ "ptr", DllStructGetPtr($V), _ "int", Ceiling($DataLen / 4), _ "ptr", DllStructGetPtr($K), _ "int", 0) Local $Ret = DllStructGetData($V, 1) $CodeBuffer = 0 $V = 0 $K = 0 Return $Ret EndFunc Func _RC4($Data, $Key) Local $Opcode = "0xC81001006A006A005356578B551031C989C84989D7F2AE484829C88945F085C00F84DC000000B90001000088C82C0188840DEFFEFFFFE2F38365F4008365FC00817DFC000100007D478B45FC31D2F775F0920345100FB6008B4DFC0FB68C0DF0FEFFFF01C80345F425FF0000008945F48B75FC8A8435F0FEFFFF8B7DF486843DF0FEFFFF888435F0FEFFFFFF45FCEBB08D9DF0FEFFFF31FF89FA39550C76638B85ECFEFFFF4025FF0000008985ECFEFFFF89D80385ECFEFFFF0FB6000385E8FEFFFF25FF0000008985E8FEFFFF89DE03B5ECFEFFFF8A0689DF03BDE8FEFFFF860788060FB60E0FB60701C181E1FF0000008A840DF0FEFFFF8B750801D6300642EB985F5E5BC9C21000" Local $CodeBuffer = DllStructCreate("byte[" & BinaryLen($Opcode) & "]") DllStructSetData($CodeBuffer, 1, $Opcode) Local $Buffer = DllStructCreate("byte[" & BinaryLen($Data) & "]") DllStructSetData($Buffer, 1, $Data) DllCall("user32.dll", "none", "CallWindowProc", "ptr", DllStructGetPtr($CodeBuffer), _ "ptr", DllStructGetPtr($Buffer), _ "int", BinaryLen($Data), _ "str", $Key, _ "int", 0) Local $Ret = DllStructGetData($Buffer, 1) $Buffer = 0 $CodeBuffer = 0 Return $Ret EndFunc
|
|
|
01/26/2010, 13:21
|
#3
|
elite*gold: 8
Join Date: Apr 2009
Posts: 2,977
Received Thanks: 855
|
werds ma testen
hmmm schaut gut aus thx aber kannste mir eventl helfen daraus ne Speicherfunktion zu machen? Sorry blicke einfach durch das Script net durch
|
|
|
01/26/2010, 14:54
|
#4
|
elite*gold: 77
Join Date: May 2008
Posts: 5,430
Received Thanks: 5,876
|
Wie meinste Speicherfunktion ?
Das programm , so wie es jetzt ist speichert doch die Verschlüsselte Datei ...
|
|
|
01/26/2010, 15:40
|
#5
|
elite*gold: 8
Join Date: Apr 2009
Posts: 2,977
Received Thanks: 855
|
ja aber wie ich das als Funktion einbauen könnte und das er das nacher wieder mit GUiCtrlSetData einfügt
|
|
|
01/26/2010, 17:15
|
#6
|
elite*gold: 77
Join Date: May 2008
Posts: 5,430
Received Thanks: 5,876
|
Quote:
Originally Posted by masterakio1995
ja aber wie ich das als Funktion einbauen könnte und das er das nacher wieder mit GUiCtrlSetData einfügt
|
Dann machst es eben raus ...
Wo liegt das Problem ?
PHP Code:
_XXTEA_Encrypt($Data, $Key)
Das dürfte doch alles erklären ....
aber hier mal Beispiel-Skript :
PHP Code:
$satz=Inputbox("","Gib den zu verschlüsselnden Satz ein") $key=Inputbox("","Gib das passwort ein") $encrypt=_XXTEA_Encrypt($satz, $key) Msgbox(0,"test",$encrypt) $decrypt=_XXTEA_Decrypt($encrypt, $key) $decrypt=BinarytoString($decrypt) Msgbox(0,"test",$decrypt)
Ich kapier einfach nicht wo dein Problem liegt ...
|
|
|
01/26/2010, 19:22
|
#7
|
elite*gold: 8
Join Date: Apr 2009
Posts: 2,977
Received Thanks: 855
|
welche includes brauch ich dafür?
Versuche es auserdem noch mit dem hier
Quote:
#include <String.au3>
FileDelete(@ScriptDir&"\CDKey.cdkey")
FileWrite(@ScriptDir&"\CDKey.cdkey",_StringEncrypt (1,"1234-5678-9876-5432","Passwort",5))
ShellExecuteWait(@ScriptDir&"\CDKey.cdkey")
ShellExecuteWait("notepad.exe",@ScriptDir&"\CDKey. cdkey")
MsgBox(0,"",_StringEncrypt(0,FileRead(@ScriptDir&" \CDKey.cdkey"),"Passwort",5))
|
das geht auch aber wen ich es versuchen zu machen wie meins
Quote:
Func Speichern()
FileWrite(@ScriptDir&"\CDKey.cdkey",_StringEncrypt (1, $Charnameanzeige, "hallo", 5))
MsgBox(0,"Test",_StringEncrypt(0,FileRead(@ScriptD ir&"\CDKey.cdkey"),"hallo",5))
EndFunc
|
Was mach ich falsch?
|
|
|
01/27/2010, 17:40
|
#8
|
elite*gold: 20
Join Date: Feb 2007
Posts: 3,080
Received Thanks: 4,294
|
in der msgbox muss es@scriptdir heissen, ansonsten wäre es mal interessant zu erfahren was funktioniert und was nicht.
Code:
#Include <String.au3>
speichern()
Func Speichern()
FileWrite(@ScriptDir&"\CDKey.cdkey",_StringEncrypt (1, "kknb", "hallo", 5))
MsgBox(0,"Test",_StringEncrypt(0,FileRead(@ScriptDir&"\CDKey.cdkey"),"hallo",5))
EndFunc
|
|
|
01/27/2010, 17:58
|
#9
|
elite*gold: 77
Join Date: May 2008
Posts: 5,430
Received Thanks: 5,876
|
Quote:
Originally Posted by masterakio1995
welche includes brauch ich dafür?
|
Garkeine ,die Funktionen sind doch in dem Skript selber drin ...
Btw mit StringEncrypt dauert es viel länger als mit "meinem" Code (Ich habe die Funktionen nicht gemacht)
Und sicherer ist StringEncrypt auch nicht (zumindest nicht wenn du es auf level 2 oder niedriger stellst ...)
|
|
|
01/27/2010, 18:03
|
#10
|
elite*gold: 0
Join Date: Apr 2009
Posts: 793
Received Thanks: 366
|
Hash.au3:
Code:
#include-once
; #FUNCTION# ;===============================================================================
;
; Name...........: _CRC32ForFile
; Description ...: Calculates CRC32 value for the specific file.
; Syntax.........: _CRC32ForFile ($sFile)
; Parameters ....: $sFile - Full path to the file to process.
; Return values .: Success - Returns CRC32 value in form of hex string
; - Sets @error to 0
; Failure - Returns empty string and sets @error:
; |1 - CreateFile function or call to it failed.
; |2 - CreateFileMapping function or call to it failed.
; |3 - MapViewOfFile function or call to it failed.
; |4 - RtlComputeCrc32 function or call to it failed.
; Author ........: trancexx
;
;==========================================================================================
Func _CRC32ForFile($sFile)
Local $a_hCall = DllCall("kernel32.dll", "hwnd", "CreateFileW", _
"wstr", $sFile, _
"dword", 0x80000000, _ ; GENERIC_READ
"dword", 1, _ ; FILE_SHARE_READ
"ptr", 0, _
"dword", 3, _ ; OPEN_EXISTING
"dword", 0, _ ; SECURITY_ANONYMOUS
"ptr", 0)
If @error Or $a_hCall[0] = -1 Then
Return SetError(1, 0, "")
EndIf
Local $hFile = $a_hCall[0]
$a_hCall = DllCall("kernel32.dll", "ptr", "CreateFileMappingW", _
"hwnd", $hFile, _
"dword", 0, _ ; default security descriptor
"dword", 2, _ ; PAGE_READONLY
"dword", 0, _
"dword", 0, _
"ptr", 0)
If @error Or Not $a_hCall[0] Then
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)
Return SetError(2, 0, "")
EndIf
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)
Local $hFileMappingObject = $a_hCall[0]
$a_hCall = DllCall("kernel32.dll", "ptr", "MapViewOfFile", _
"hwnd", $hFileMappingObject, _
"dword", 4, _ ; FILE_MAP_READ
"dword", 0, _
"dword", 0, _
"dword", 0)
If @error Or Not $a_hCall[0] Then
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(3, 0, "")
EndIf
Local $pFile = $a_hCall[0]
Local $iBufferSize = FileGetSize($sFile)
Local $a_iCall = DllCall("ntdll.dll", "dword", "RtlComputeCrc32", _
"dword", 0, _
"ptr", $pFile, _
"int", $iBufferSize)
If @error Or Not $a_iCall[0] Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(4, 0, "")
EndIf
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Local $iCRC32 = $a_iCall[0]
Return SetError(0, 0, Hex($iCRC32))
EndFunc ;==>_CRC32ForFile
; #FUNCTION# ;===============================================================================
;
; Name...........: _MD4ForFile
; Description ...: Calculates MD4 value for the specific file.
; Syntax.........: _MD4ForFile ($sFile)
; Parameters ....: $sFile - Full path to the file to process.
; Return values .: Success - Returns MD4 value in form of hex string
; - Sets @error to 0
; Failure - Returns empty string and sets @error:
; |1 - CreateFile function or call to it failed.
; |2 - CreateFileMapping function or call to it failed.
; |3 - MapViewOfFile function or call to it failed.
; |4 - MD4Init function or call to it failed.
; |5 - MD4Update function or call to it failed.
; |6 - MD4Final function or call to it failed.
; Author ........: trancexx
;
;==========================================================================================
Func _MD4ForFile($sFile)
Local $a_hCall = DllCall("kernel32.dll", "hwnd", "CreateFileW", _
"wstr", $sFile, _
"dword", 0x80000000, _ ; GENERIC_READ
"dword", 1, _ ; FILE_SHARE_READ
"ptr", 0, _
"dword", 3, _ ; OPEN_EXISTING
"dword", 0, _ ; SECURITY_ANONYMOUS
"ptr", 0)
If @error Or $a_hCall[0] = -1 Then
Return SetError(1, 0, "")
EndIf
Local $hFile = $a_hCall[0]
$a_hCall = DllCall("kernel32.dll", "ptr", "CreateFileMappingW", _
"hwnd", $hFile, _
"dword", 0, _ ; default security descriptor
"dword", 2, _ ; PAGE_READONLY
"dword", 0, _
"dword", 0, _
"ptr", 0)
If @error Or Not $a_hCall[0] Then
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)
Return SetError(2, 0, "")
EndIf
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)
Local $hFileMappingObject = $a_hCall[0]
$a_hCall = DllCall("kernel32.dll", "ptr", "MapViewOfFile", _
"hwnd", $hFileMappingObject, _
"dword", 4, _ ; FILE_MAP_READ
"dword", 0, _
"dword", 0, _
"dword", 0)
If @error Or Not $a_hCall[0] Then
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(3, 0, "")
EndIf
Local $pFile = $a_hCall[0]
Local $iBufferSize = FileGetSize($sFile)
Local $tMD4_CTX = DllStructCreate("dword i[2];" & _
"dword buf[4];" & _
"ubyte in[64];" & _
"ubyte digest[16]")
DllCall("advapi32.dll", "none", "MD4Init", "ptr", DllStructGetPtr($tMD4_CTX))
If @error Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(4, 0, "")
EndIf
DllCall("advapi32.dll", "none", "MD4Update", _
"ptr", DllStructGetPtr($tMD4_CTX), _
"ptr", $pFile, _
"dword", $iBufferSize)
If @error Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(5, 0, "")
EndIf
DllCall("advapi32.dll", "none", "MD4Final", "ptr", DllStructGetPtr($tMD4_CTX))
If @error Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(6, 0, "")
EndIf
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Local $sMD4 = Hex(DllStructGetData($tMD4_CTX, "digest"))
Return SetError(0, 0, $sMD4)
EndFunc ;==>_MD4ForFile
; #FUNCTION# ;===============================================================================
;
; Name...........: _MD5ForFile
; Description ...: Calculates MD5 value for the specific file.
; Syntax.........: _MD5ForFile ($sFile)
; Parameters ....: $sFile - Full path to the file to process.
; Return values .: Success - Returns MD5 value in form of hex string
; - Sets @error to 0
; Failure - Returns empty string and sets @error:
; |1 - CreateFile function or call to it failed.
; |2 - CreateFileMapping function or call to it failed.
; |3 - MapViewOfFile function or call to it failed.
; |4 - MD5Init function or call to it failed.
; |5 - MD5Update function or call to it failed.
; |6 - MD5Final function or call to it failed.
; Author ........: trancexx
;
;==========================================================================================
Func _MD5ForFile($sFile)
Local $a_hCall = DllCall("kernel32.dll", "hwnd", "CreateFileW", _
"wstr", $sFile, _
"dword", 0x80000000, _ ; GENERIC_READ
"dword", 1, _ ; FILE_SHARE_READ
"ptr", 0, _
"dword", 3, _ ; OPEN_EXISTING
"dword", 0, _ ; SECURITY_ANONYMOUS
"ptr", 0)
If @error Or $a_hCall[0] = -1 Then
Return SetError(1, 0, "")
EndIf
Local $hFile = $a_hCall[0]
$a_hCall = DllCall("kernel32.dll", "ptr", "CreateFileMappingW", _
"hwnd", $hFile, _
"dword", 0, _ ; default security descriptor
"dword", 2, _ ; PAGE_READONLY
"dword", 0, _
"dword", 0, _
"ptr", 0)
If @error Or Not $a_hCall[0] Then
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)
Return SetError(2, 0, "")
EndIf
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)
Local $hFileMappingObject = $a_hCall[0]
$a_hCall = DllCall("kernel32.dll", "ptr", "MapViewOfFile", _
"hwnd", $hFileMappingObject, _
"dword", 4, _ ; FILE_MAP_READ
"dword", 0, _
"dword", 0, _
"dword", 0)
If @error Or Not $a_hCall[0] Then
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(3, 0, "")
EndIf
Local $pFile = $a_hCall[0]
Local $iBufferSize = FileGetSize($sFile)
Local $tMD5_CTX = DllStructCreate("dword i[2];" & _
"dword buf[4];" & _
"ubyte in[64];" & _
"ubyte digest[16]")
DllCall("advapi32.dll", "none", "MD5Init", "ptr", DllStructGetPtr($tMD5_CTX))
If @error Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(4, 0, "")
EndIf
DllCall("advapi32.dll", "none", "MD5Update", _
"ptr", DllStructGetPtr($tMD5_CTX), _
"ptr", $pFile, _
"dword", $iBufferSize)
If @error Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(5, 0, "")
EndIf
DllCall("advapi32.dll", "none", "MD5Final", "ptr", DllStructGetPtr($tMD5_CTX))
If @error Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(6, 0, "")
EndIf
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Local $sMD5 = Hex(DllStructGetData($tMD5_CTX, "digest"))
Return SetError(0, 0, $sMD5)
EndFunc ;==>_MD5ForFile
; #FUNCTION# ;===============================================================================
;
; Name...........: _SHA1ForFile
; Description ...: Calculates SHA1 value for the specific file.
; Syntax.........: _SHA1ForFile ($sFile)
; Parameters ....: $sFile - Full path to the file to process.
; Return values .: Success - Returns SHA1 value in form of hex string
; - Sets @error to 0
; Failure - Returns empty string and sets @error:
; |1 - CreateFile function or call to it failed.
; |2 - CreateFileMapping function or call to it failed.
; |3 - MapViewOfFile function or call to it failed.
; |4 - CryptAcquireContext function or call to it failed.
; |5 - CryptCreateHash function or call to it failed.
; |6 - CryptHashData function or call to it failed.
; |7 - CryptGetHashParam function or call to it failed.
; Author ........: trancexx
;
;==========================================================================================
Func _SHA1ForFile($sFile)
Local $a_hCall = DllCall("kernel32.dll", "hwnd", "CreateFileW", _
"wstr", $sFile, _
"dword", 0x80000000, _ ; GENERIC_READ
"dword", 1, _ ; FILE_SHARE_READ
"ptr", 0, _
"dword", 3, _ ; OPEN_EXISTING
"dword", 0, _ ; SECURITY_ANONYMOUS
"ptr", 0)
If @error Or $a_hCall[0] = -1 Then
Return SetError(1, 0, "")
EndIf
Local $hFile = $a_hCall[0]
$a_hCall = DllCall("kernel32.dll", "ptr", "CreateFileMappingW", _
"hwnd", $hFile, _
"dword", 0, _ ; default security descriptor
"dword", 2, _ ; PAGE_READONLY
"dword", 0, _
"dword", 0, _
"ptr", 0)
If @error Or Not $a_hCall[0] Then
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)
Return SetError(2, 0, "")
EndIf
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)
Local $hFileMappingObject = $a_hCall[0]
$a_hCall = DllCall("kernel32.dll", "ptr", "MapViewOfFile", _
"hwnd", $hFileMappingObject, _
"dword", 4, _ ; FILE_MAP_READ
"dword", 0, _
"dword", 0, _
"dword", 0)
If @error Or Not $a_hCall[0] Then
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(3, 0, "")
EndIf
Local $pFile = $a_hCall[0]
Local $iBufferSize = FileGetSize($sFile)
Local $a_iCall = DllCall("advapi32.dll", "int", "CryptAcquireContext", _
"ptr*", 0, _
"ptr", 0, _
"ptr", 0, _
"dword", 1, _ ; PROV_RSA_FULL
"dword", 0xF0000000) ; CRYPT_VERIFYCONTEXT
If @error Or Not $a_iCall[0] Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(4, 0, "")
EndIf
Local $hContext = $a_iCall[1]
$a_iCall = DllCall("advapi32.dll", "int", "CryptCreateHash", _
"ptr", $hContext, _
"dword", 0x00008004, _ ; CALG_SHA1
"ptr", 0, _ ; nonkeyed
"dword", 0, _
"ptr*", 0)
If @error Or Not $a_iCall[0] Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
DllCall("advapi32.dll", "int", "CryptReleaseContext", "ptr", $hContext, "dword", 0)
Return SetError(5, 0, "")
EndIf
Local $hHashSHA1 = $a_iCall[5]
$a_iCall = DllCall("advapi32.dll", "int", "CryptHashData", _
"ptr", $hHashSHA1, _
"ptr", $pFile, _
"dword", $iBufferSize, _
"dword", 0)
If @error Or Not $a_iCall[0] Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
DllCall("advapi32.dll", "int", "CryptDestroyHash", "ptr", $hHashSHA1)
DllCall("advapi32.dll", "int", "CryptReleaseContext", "ptr", $hContext, "dword", 0)
Return SetError(6, 0, "")
EndIf
Local $tOutSHA1 = DllStructCreate("byte[20]")
$a_iCall = DllCall("advapi32.dll", "int", "CryptGetHashParam", _
"ptr", $hHashSHA1, _
"dword", 2, _ ; HP_HASHVAL
"ptr", DllStructGetPtr($tOutSHA1), _
"dword*", 20, _
"dword", 0)
If @error Or Not $a_iCall[0] Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
DllCall("advapi32.dll", "int", "CryptDestroyHash", "ptr", $hHashSHA1)
DllCall("advapi32.dll", "int", "CryptReleaseContext", "ptr", $hContext, "dword", 0)
Return SetError(7, 0, "")
EndIf
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
DllCall("advapi32.dll", "int", "CryptDestroyHash", "ptr", $hHashSHA1)
Local $sSHA1 = Hex(DllStructGetData($tOutSHA1, 1))
DllCall("advapi32.dll", "int", "CryptReleaseContext", "ptr", $hContext, "dword", 0)
Return SetError(0, 0, $sSHA1)
EndFunc ;==>_SHA1ForFile
|
|
|
01/27/2010, 19:32
|
#11
|
elite*gold: 8
Join Date: Apr 2009
Posts: 2,977
Received Thanks: 855
|
hab jetzt erstma so
Quote:
#Include <String.au3>
FileDelete("CDKey.cdkey")
speichern()
Func Speichern()
FileWrite(@ScriptDir&"\CDKey.cdkey",_StringEncrypt (1, "test", "hallo", 5))
MsgBox(0,"Test",_StringEncrypt(0,FileRead(@ScriptD ir&"\CDKey.cdkey"),"hallo",5))
EndFunc
|
Werds jetzt erstma testen danach werd ich bescheid sagen ob es klappt
€.Ok funzt aber kann mir noch einer sagen wie ich es so machen kan das wen z.b bei der zahl 1000 eine msgbox kommt auch bei z.b 1001 kommt ohne das ich alle werte eingebe?
€2.so es funzt zwar zu speichern aber wen ich es paar mal mache kommen solche komischen buchstaben rein -.- wiest ihr woran das liegt?
Quote:
Func Speichern()
$Read10 = GUICtrlRead($Charnameanzeige)
FileWrite(@ScriptDir&"\Dragonfight.save",_StringEn crypt (1, $Read10, "hallo", 5))
MsgBox(0,"Test",_StringEncrypt(0,FileRead(@ScriptD ir&"\Dragonfight.save"),"hallo",5))
GUICtrlSetData($Charnameanzeige,_StringEncrypt(0,F ileRead(@ScriptDir&"\Dragonfight.save"),"hallo",5) )
EndFunc
|
|
|
|
08/12/2010, 10:47
|
#12
|
elite*gold: 0
Join Date: Aug 2010
Posts: 13
Received Thanks: 0
|
kleine Frage zwischendurch:
Wie kann man .ini-Dateien mit autoit oder so verschlüsseln?
|
|
|
08/12/2010, 11:58
|
#13
|
elite*gold: 0
Join Date: Mar 2008
Posts: 1,524
Received Thanks: 285
|
hier:
|
|
|
08/12/2010, 13:25
|
#14
|
elite*gold: 8
Join Date: Apr 2009
Posts: 2,977
Received Thanks: 855
|
habt ihr mal aufs datum geschaut?
|
|
|
08/12/2010, 14:00
|
#15
|
elite*gold: 0
Join Date: Mar 2008
Posts: 1,524
Received Thanks: 285
|
hast du mal aufs datum geschaut?
Heute, 10:47
nc zu dir
|
|
|
|
|
Similar Threads
|
Eix, Epk Verschlüsseln ~ Programm.
09/12/2010 - Metin2 Private Server - 8 Replies
Hallo,
Hier verkaufe ich ein Programm
mit dem ihr eure
Eix, Epk verschlüsseln könnt,
undso mit kann dan keiner von euch was klauen..
bzw IP herausfinde.
Was ich dafür will?
|
Passwort verschlüsseln ?
03/18/2010 - Metin2 Private Server - 9 Replies
Hey,
Ich suche nen How To um 'n passwort zu verschlüsseln damit man Leute auf nem Server manuel regestrieren kann.
Ich weiß das man es mit MsQL oder so verschlüsseln muss aber keine Ahnung wie =)
Wäre nett wenn ihr mir helfen könntet.
|
verschlüsseln
05/12/2008 - Kal Online - 0 Replies
also ich hab das pw von unity v2 herausgefunden und will jetzt die jobsystem-e datei wechseln also lösch ich die eine und tuh die neue rein muss jetzt noch die neue verschlüseln aber das klappt nicht ich hab schon viele sachenn gedownloaded und probiert die verschlüsseln alle aber das klappt trotztdem nie.deswegen wollt ich fragen wie ich es verschlüsseln soll.mit winrar verschlüsselt das garnet wen ich probiere.hab das jobsystem-e von zogga benutz der hat hier ma ein tut geschrieben.
und das...
|
.iso Dateien entschlüsseln
04/15/2006 - Off Topic - 6 Replies
Ich wollte fragen, mit welchen Programmen man .iso-Dateien entschlüsseln/entpacken kann. Wäre über eine Antwort sehr erfreut. :p
edit : Und dazu ein einfacher Laufwerksimulator wär ganz nett. X-D
|
All times are GMT +2. The time now is 22:52.
|
|