Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Internet
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #11  
Antiguo 09-05-2023
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.075
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Algo así:


Código Delphi [-]
uses
  IdHash, IdHashSHA, IdGlobal, SysUtils;

function CalculateFileHash(const FileName: string): string;
var
  FileStream: TFileStream;
  SHA256Hash: TIdHashSHA256;
  HashBytes: TBytes;
begin
  FileStream := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);
  try
    SHA256Hash := TIdHashSHA256.Create;
    try
      HashBytes := SHA256Hash.HashValue(FileStream);
      Result := LowerCase(BytesToHex(HashBytes));
    finally
      SHA256Hash.Free;
    end;
  finally
    FileStream.Free;
  end;
end;

// Ejemplo de uso:
procedure TForm1.Button1Click(Sender: TObject);
var
  FileName: string;
  HashValue: string;
begin
  FileName := 'ruta_del_archivo.xml';
  HashValue := CalculateFileHash(FileName);
  ShowMessage('Hash SHA256 del archivo XML: ' + HashValue);
end;
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Hijo de Informáticos gluglu Humor 3 13-03-2007 11:05:35
Adictos informaticos ... Trigger Humor 2 11-10-2004 12:18:32
Nosotros los Informáticos Trigger Humor 1 10-10-2004 14:58:09
Patrón de los Informáticos. obiwuan Varios 20 10-09-2003 14:44:54
Chistes Informaticos jhonny Humor 2 11-08-2003 21:59:09


La franja horaria es GMT +2. Ahora son las 11:11:10.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi