this procedure get the CRC32 of a file.
Yes there are alternatives more fast but this solution doesn't require external libraries or asm code.

Code: Select all
Procedure.s GetFileCRC32(file$)
Protected crc32$,length,*MemoryBuffer
If (ReadFile(0,file$))
length = Lof(0)
If (length)
*MemoryBuffer = AllocateMemory(length)
If (*MemoryBuffer)
If (ReadData(0,*MemoryBuffer,length))
crc32$ = Hex(CRC32Fingerprint(*MemoryBuffer,length))
EndIf
FreeMemory(*MemoryBuffer)
EndIf
Else
crc32$ = "0"
EndIf
CloseFile(0)
EndIf
ProcedureReturn crc32$
EndProcedure
path$ = OpenFileRequester("Select a file", "","Text (*.txt)|*.txt;*.bat|PureBasic (*.pb)|*.pb|All files (*.*)|*.*", 0)
Debug "File path: " + path$
Debug "CRC32: " + GetFileCRC32(path$)