Hi,
I noticed when I read file in bytes even text files < less by two bytes when I read file in php in server:
Carriage Return
Line Feed
The problem the Check sum such as MD5 or SHA will be different from the one in any other platform(e.g.: PHP)
This is the code I am using to read and calc the MD5 ( I found it in the forum)
My question: how to include all bytes in the buffer even the
Carriage Return
Line Feed
to calculate the actual check sum for the whole data file? it is important for me for the integrity.
Thank you
I noticed when I read file in bytes even text files < less by two bytes when I read file in php in server:
Carriage Return
Line Feed
The problem the Check sum such as MD5 or SHA will be different from the one in any other platform(e.g.: PHP)
This is the code I am using to read and calc the MD5 ( I found it in the forum)
B4X:
Dim d As String = File.DirRootExternal
Dim In As InputStream
In = File.OpenInput(d,"test.txt")
Dim buffer(File.Size(d, "test.txt") ) As Byte
Count = In.ReadBytes(buffer, 0, buffer.length)
Log("Count :: " & Count )
Dim Bconv As ByteConverter
Dim data(buffer.Length) As Byte
Log("data :: " & data )
Dim md As MessageDigest
data = md.GetMessageDigest(buffer, "MD5")
Log("Hash: " & Bconv.HexFromBytes(data))
My question: how to include all bytes in the buffer even the
Carriage Return
Line Feed
to calculate the actual check sum for the whole data file? it is important for me for the integrity.
Thank you