Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) Hash File: SHA-1, HAVAL, MD2, MD5, SHA-256, SHA-384, SHA-512Computing the hash for a file of any size.
integer li_rc oleobject loo_Crypt string ls_Filename string ls_Hash // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. loo_Crypt = create oleobject // Use "Chilkat_9_5_0.Crypt2" for versions of Chilkat < 10.0.0 li_rc = loo_Crypt.ConnectToNewObject("Chilkat.Crypt2") if li_rc < 0 then destroy loo_Crypt MessageBox("Error","Connecting to COM object failed") return end if // Any type of file may be hashed. // There is no size limitation because the file is consumed // in streaming mode internally. ls_Filename = "something.zip" loo_Crypt.HashAlgorithm = "sha1" loo_Crypt.EncodingMode = "hex" // Other possible EncodingMode settings are: // "quoted-printable", "base64", "base32", and "url" ls_Hash = loo_Crypt.HashFileENC(ls_Filename) Write-Debug "SHA1:" Write-Debug ls_Hash // Hash using MD2 loo_Crypt.HashAlgorithm = "md2" ls_Hash = loo_Crypt.HashFileENC(ls_Filename) Write-Debug "MD2:" Write-Debug ls_Hash // Hash using MD5 loo_Crypt.HashAlgorithm = "md5" ls_Hash = loo_Crypt.HashFileENC(ls_Filename) Write-Debug "MD5:" Write-Debug ls_Hash // Hash using SHA-256 loo_Crypt.HashAlgorithm = "sha256" ls_Hash = loo_Crypt.HashFileENC(ls_Filename) Write-Debug "SHA256:" Write-Debug ls_Hash // Hash using SHA-384 loo_Crypt.HashAlgorithm = "sha384" ls_Hash = loo_Crypt.HashFileENC(ls_Filename) Write-Debug "SHA384:" Write-Debug ls_Hash // Hash using SHA-512 loo_Crypt.HashAlgorithm = "sha512" ls_Hash = loo_Crypt.HashFileENC(ls_Filename) Write-Debug "SHA512:" Write-Debug ls_Hash // Hash using HAVAL // There are two additional properties relevant to HAVAL: // HavalRounds, and KeyLength. // HavalRounds can have values of 3, 4, or 5. // KeyLength can have values of 128, 160, 192, 224, or 256 loo_Crypt.HashAlgorithm = "haval" loo_Crypt.HavalRounds = 5 loo_Crypt.KeyLength = 256 ls_Hash = loo_Crypt.HashFileENC(ls_Filename) Write-Debug "Haval:" Write-Debug ls_Hash destroy loo_Crypt |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.