![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Delphi DLL) Workaround for the deprecated Crypt2.HashFile methodShows how to replace the deprecated HashFile method. (Chilkat is moving away from the use of CkByteData.) Note: This example requires Chilkat v11.0.0 or greater.
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, CkByteData, Crypt2; ... procedure TForm1.Button1Click(Sender: TObject); var crypt: HCkCrypt2; path: PWideChar; outData: HCkByteData; hex_hash: PWideChar; begin crypt := CkCrypt2_Create(); CkCrypt2_putHashAlgorithm(crypt,'sha256'); path := 'c:/someDir/example.dat'; // ------------------------------------------------------------------------ // The HashFile method is deprecated: outData := CkByteData_Create(); success := CkCrypt2_HashFile(crypt,path,outData); // ------------------------------------------------------------------------ // Workaround. // (Chilkat is moving away from using CkByteData) CkCrypt2_putEncodingMode(crypt,'hex_lower'); hex_hash := CkCrypt2__hashFileENC(crypt,path); CkCrypt2_Dispose(crypt); CkByteData_Dispose(outData); end; |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.