Warum ist in der Include <Crypt> kein SHA2 integriert?
Hab das ganze mal erweitert
<Crypt.au3> | SHA 2 Erweiterung
[autoit]
[...}
Global Const $CALG_SHA_256 = 0x0000800c
Global Const $CALG_SHA_384 = 0x0000800d
Global Const $CALG_SHA_512 = 0x0000800e
[...]
_Crypt_HashData.au3 | Helpfile Erweiterung
Spoiler anzeigen
#include <Crypt.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
Global $bAlgorithm = $CALG_SHA1, $iInputEdit = -1, $iOutputEdit = -1
[/autoit] [autoit][/autoit] [autoit]GUICreate("Realtime Hashing", 400, 320)
$iInputEdit = GUICtrlCreateEdit("", 0, 0, 400, 150, $ES_WANTRETURN)
$iOutputEdit = GUICtrlCreateEdit("", 0, 150, 400, 150, $ES_READONLY)
Local $iCombo = GUICtrlCreateCombo("", 0, 300, 100, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "MD2|MD4|MD5|SHA1|SHA256|SHA384|SHA512", "SHA1")
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
GUISetState(@SW_SHOW)
_Crypt_Startup() ; To optimize performance start the crypt library.
[/autoit] [autoit][/autoit] [autoit]While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $iCombo ; Check when the combobox is selected and retrieve the correct algorithm.
Switch GUICtrlRead($iCombo) ; Read the combobox selection.
Case "MD2"
$bAlgorithm = $CALG_MD2
Case "MD4"
$bAlgorithm = $CALG_MD4
Case "MD5"
$bAlgorithm = $CALG_MD5
Case "SHA1"
$bAlgorithm = $CALG_SHA1
Case "SHA256"
If (@OSVersion = "WIN_2000") Or (@OSVersion = "WIN_XPe") Then
MsgBox(16, "Error", "Sorry, this algorithm is not available. Windows XP SP3+ only.") ; Show an error if the system is not Windows XP SP3+.
ContinueLoop
EndIf
$bAlgorithm = $CALG_SHA_256
Case "SHA384"
If (@OSVersion = "WIN_2000") Or (@OSVersion = "WIN_XPe") Then
MsgBox(16, "Error", "Sorry, this algorithm is not available. Windows XP SP3+ only.") ; Show an error if the system is not Windows XP SP3+.
ContinueLoop
EndIf
$bAlgorithm = $CALG_SHA_384
Case "SHA512"
If (@OSVersion = "WIN_2000") Or (@OSVersion = "WIN_XPe") Then
MsgBox(16, "Error", "Sorry, this algorithm is not available. Windows XP SP3+ only.") ; Show an error if the system is not Windows XP SP3+.
ContinueLoop
EndIf
$bAlgorithm = $CALG_SHA_512
EndSwitch
Local $sRead = GUICtrlRead($iInputEdit)
If StringStripWS($sRead, <> "" Then ; Check there is text available to hash.
Local $bHash = _Crypt_HashData($sRead, $bAlgorithm) ; Create a hash of the text entered.
GUICtrlSetData($iOutputEdit, $bHash) ; Set the output box with the hash data.
EndIf
EndSwitch
WEnd
_Crypt_Shutdown() ; Shutdown the crypt library.
[/autoit] [autoit][/autoit] [autoit]Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
#forceref $hWnd, $iMsg, $lParam
Switch _WinAPI_LoWord($wParam)
Case $iInputEdit
Switch _WinAPI_HiWord($wParam)
Case $EN_CHANGE
Local $bHash = _Crypt_HashData(GUICtrlRead($iInputEdit), $bAlgorithm) ; Create a hash of the text entered.
GUICtrlSetData($iOutputEdit, $bHash) ; Set the output box with the hash data.
EndSwitch
EndSwitch
EndFunc ;==>WM_COMMAND
Bilder:
Spoiler anzeigen
incl SHA2 (SHA 256, SHA 384 & SHA 512)
[Blockierte Grafik: http://img4.fotos-hochladen.net/uploads/20121227101rv26w78smh.jpg]
Fehler wenn Betriebssystem für die Funktion veraltet ist
[Blockierte Grafik: http://img3.fotos-hochladen.net/uploads/20121227103eit6nupo73.jpg]