Hello!
How to Calculate the Hash of a PDF File
Does anyone know how to calculate the hash of a pdf or jpg file using Xbase ++?
Something like that:
' VB.NET
Dim Imagem = "imagem.jpg"
Dim HashImagem = CalcularHash(Imagem)
Dim HashImagemString = BitConverter.ToString(HashImagem).Replace("-", "").ToLower()
Console.WriteLine(HashImagemString)
' VB.NET
Private Function CalcularHash(Arquivo As String) As Byte()
Using Md5 = System.Security.Cryptography.MD5.Create()
Using Stream = System.IO.File.OpenRead(Arquivo)
Return Md5.ComputeHash(Stream)
End Using
End Using
End Function
How to Calculate the Hash of a PDF File
How to Calculate the Hash of a PDF File
Pedro Alexandre
Re: How to Calculate the Hash of a PDF File
Use and set before.
Code: Select all
Char2Hash(<cStream>)
Code: Select all
SET HASH TO MD5
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Re: How to Calculate the Hash of a PDF File
Tom.
Many thanks !
How get the "csTream" ?
cStream := Memoread('File.Pdf') !?
Many thanks !
How get the "csTream" ?
cStream := Memoread('File.Pdf') !?
Pedro Alexandre
Re: How to Calculate the Hash of a PDF File
Wow. I have been using a 3rd party library for doing MD5 hash for a long time.
How long has this been in Xbase++?
How long has this been in Xbase++?
The eXpress train is coming - and it has more cars.
Re: How to Calculate the Hash of a PDF File
@Pedro: I prefer FileStr(), but, yeah, this is the way to get the binary string to create the hash from.
@Roger: I think since two, three years, but, nowadays, time seems to go by faster in reality than in my memory.
Edit: Introduced in 2.00.1271, whenever that was.
@Roger: I think since two, three years, but, nowadays, time seems to go by faster in reality than in my memory.
Edit: Introduced in 2.00.1271, whenever that was.
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Re: How to Calculate the Hash of a PDF File
Tom,
Many thanks !
Roger,
The MD5 Hash Algorithm only became available in 2020
the Char2Hash() "MD5" parameter was only available on Build 1271 - 29-06-2020.
Many thanks !
Roger,
The MD5 Hash Algorithm only became available in 2020
the Char2Hash() "MD5" parameter was only available on Build 1271 - 29-06-2020.
Pedro Alexandre