Jump to content

Search the Community

Showing results for tags '_crypt_hashdata'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 2 results

  1. File Hash Generator Working script: #RequireAdmin #include <Crypt.au3> #include <File.au3> Global $DirToFindFile = @ScriptDir _Crypt_Startup() Global $aListFile = _FileListToArrayRec($DirToFindFile, "*", 1, 1, 2, 2) For $i = 1 To $aListFile[0] ToolTip($i & "/" & $aListFile[0] & " - See Console") ConsoleWrite("-File : " & $aListFile[$i] & @CRLF) ConsoleWrite("MD2 : " & _HASH_Calculator($aListFile[$i], "MD2") & " - Error: " & @error & @CRLF) ConsoleWrite("MD5 : " & _HASH_Calculator($aListFile[$i], "MD4") & " - Error: " & @error & @CRLF) ConsoleWrite("MD5 : " & _HASH_Calculator($aListFile[$i], "MD5") & " - Error: " & @error & @CRLF) ConsoleWrite("SHA1 : " & _HASH_Calculator($aListFile[$i], "SHA1") & " - Error: " & @error & @CRLF) ConsoleWrite("SHA256: " & _HASH_Calculator($aListFile[$i], "SHA256") & " - Error: " & @error & @CRLF) ConsoleWrite("SHA384: " & _HASH_Calculator($aListFile[$i], "SHA384") & " - Error: " & @error & @CRLF) ConsoleWrite("SHA512: " & _HASH_Calculator($aListFile[$i], "SHA512") & " - Error: " & @error & @CRLF) ConsoleWrite("CRC32 : " & _HASH_Calculator($aListFile[$i], "CRC32") & " - Error: " & @error & @CRLF) Next Func _HASH_Calculator($sFilePath, $sHashType = "CRC32", $ctrlSetDataText = 0, $ctrlSetPercent = 0) ;~ ConsoleWrite("! " &$sFilePath & @CRLF) Local $iHash = "", $iError = 0 $sHashType = StringUpper(StringStripWS($sHashType, 8)) If $ctrlSetDataText Then GUICtrlSetData($ctrlSetDataText, ' Calculator [' & $sHashType & ']: ' & $sFilePath) Switch $sHashType Case "MD2" $iHash = _Crypt_HashFile($sFilePath, $CALG_MD2) Case "MD4" $iHash = _Crypt_HashFile($sFilePath, $CALG_MD4) Case "MD5" $iHash = _Crypt_HashFile($sFilePath, $CALG_MD5) Case "SHA1" $iHash = _Crypt_HashFile($sFilePath, $CALG_SHA1) Case "SHA256" $iHash = _Crypt_HashFile($sFilePath, $CALG_SHA_256) Case "SHA384" $iHash = _Crypt_HashFile($sFilePath, $CALG_SHA_384) Case "SHA512" $iHash = _Crypt_HashFile($sFilePath, $CALG_SHA_512) Case Else $iHash = _CRC32_Calculator($sFilePath) EndSwitch $iError = @error If (StringLeft($iHash, 2) = "0x") Then $iHash = StringTrimLeft($iHash, 2) If $ctrlSetDataText Then GUICtrlSetData($ctrlSetDataText, ' DONE ') If ($iError > 0) And ($iHash = "") Then Return SetError($iError, 0, "- ERROR: " & $iError) Return SetError($iError, 0, StringUpper($iHash)) EndFunc ;==>_HASH_Calculator Func _CRC32_Calculator($sFilePath) Local $a_hCall = DllCall("kernel32.dll", "hwnd", "CreateFileW", "wstr", $sFilePath, "dword", 0x80000000, "dword", 3, "ptr", 0, "dword", 3, "dword", 0, "ptr", 0) If @error Or ($a_hCall[0] = -1) Then Return SetError(1, 0, "") Local $hFile = $a_hCall[0] $a_hCall = DllCall("kernel32.dll", "ptr", "CreateFileMappingW", "hwnd", $hFile, "dword", 0, "dword", 2, "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, "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($sFilePath) 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, 8)) EndFunc ;==>_CRC32_Calculator
  2. I am creating a script that changes important account information, including passwords and usernames, but I can't take the input from a user at runtime. I could get the script to work with the information included in variables, but that is a security risk we want to avoid. As far as I can tell, _Crypt_HashData or possible _Crypt_EncryptData are how I would go about this. I looked at the help file and I am struggling to understand the implementation. Do I need an external document with the info? That would present the same issue. Do I need to create the variable and then run the function in another script and then add it in? I am quite lost. Could somone give me a basic step-by-step rundown?
×
×
  • Create New...