Hashes a string.
#Include <WinAPIEx.au3>
_WinAPI_HashString ( $sString [, $fCaseSensitive [, $iLength]] )
$sString | The string to hash. |
$fCaseSensitive | [可选参数] Specifies whether to treat the string as case sensitive when computing the hash value, valid values: TRUE - The lowercase and uppercase string hash to the different value. (Default) FALSE - The lowercase and uppercase string hash to the same value. |
$iLength | [可选参数] The length of the hash data, in bytes. It should be no larger than 256, otherwise, the function fails. |
Success | The hash data in binary form. |
失败: | 返回 0 并设置 @error 标志为非 0 值, @extended 标志可能包含一个系统错误代码. |
#Include <APIConstants.au3>
#Include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $hForm, $Msg, $Input1, $Input2, $Hash
$hForm = GUICreate('MyGUI', 400, 96)
$Input1 = GUICtrlCreateInput('', 20, 20, 360, 20)
GUICtrlSetLimit(-1, 255)
$Input2 = GUICtrlCreateInput('', 20, 56, 360, 20, BitOR($GUI_SS_DEFAULT_INPUT, $ES_READONLY))
GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND')
GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
Switch $hWnd
Case $hForm
Switch _WinAPI_LoWord($wParam)
Case $Input1
Switch _WinAPI_HiWord($wParam)
Case $EN_CHANGE
$Hash = _WinAPI_HashString(GUICtrlRead($Input1), 0, 16)
If Not @error Then
GUICtrlSetData($Input2, $Hash)
Else
GUICtrlSetData($Input2, '')
EndIf
EndSwitch
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND