[fpc-pascal] Fast CRC functions?
Bruno Krayenbuhl
kraybruno at bluewin.ch
Wed Aug 27 12:00:12 CEST 2014
Quote :So you would not use this new crc32c() function to replace the zlib's
crc32() function, but as a convenient very fast hashing function at
application level.
For instance, our TDynArray wrapper will use it for fast items hashing.>
hashing function at application level
Problem : does it exist on other processor architectures ?
An alternative if you dont need a standard CRC, for FPC internals. Needs to
be retested by someone else.
What I dont know is if this algorythm would always give the EXACT same hash
value on any processor. It is written in pure pascal so should be testable
on various achitectures.
These are my timings calculating CRC and FNV Hash on a Win32 Dual-Core CPU.
Calculating CRC, FNVHash and SHA1 on file
lazarus\1.3\lcl\include\wincontrol.inc rev. 45788
Compiled with -O3
CRC : 2 ms, 48 mus CRC : 7df71ee1 unit fpccrc.pas
FNV : 619 mus FNV : 54b39e30 unit uFnvHash32buf.pp
SHA1 : 3 ms, 318 mus unit
fpc-2.6.4\packages\hash\src\sha1.pp
CRC handles 1 complete buffer at the byte level
FNV handles 1 complete buffer at the DWORD level (Probably a problem with
Endianness)
SHA1 handles streams and can be continued after intermediate results and of
course returns a very long digest.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uFnvHash32buf.zip
Type: application/x-zip-compressed
Size: 2313 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140827/fa637fae/attachment.bin>
More information about the fpc-pascal
mailing list