PCL
Non-Cryptographic Hash Functions

Functions

uint32 pcl::Hash32 (const void *data, size_type size, uint32 seed=0) noexcept
 
uint64 pcl::Hash64 (const void *data, size_type size, uint64 seed=0) noexcept
 

Detailed Description

Function Documentation

◆ Hash32()

uint32 pcl::Hash32 ( const void *  data,
size_type  size,
uint32  seed = 0 
)
inlinenoexcept

Computes a 32-bit non-cryptographic hash function.

Parameters
dataAddress of the first byte of the input data block.
sizeLength in bytes of the input data block.
seedOptional seed value for initialization of the hash function. If seed is zero or is not specified, the seed will be set equal to the length of the data block.

Returns a 32-bit hash value computed from the input data block.

Test vector: "The quick brown fox jumps over the lazy dog"
Hash32 checksum = 752cd1b8
Test vector: "" (empty string)
Hash32 checksum = 2cc5d05

This function implements the xxHash algorithm by Yann Collet. Our code is an adaptation of the original code by the author:

https://github.com/Cyan4973/xxHash

Copyright (C) 2012-2014, Yann Collet.
The original code has been released under the BSD 2-Clause License:

http://www.opensource.org/licenses/bsd-license.php

Definition at line 4904 of file Math.h.

Referenced by pcl::GenericVector< bool >::Hash32(), pcl::Array< GaiaStarData >::Hash32(), pcl::GenericMatrix< coefficient >::Hash32(), pcl::GenericString< char, IsoCharTraits, PCL_STRING_ALLOCATOR >::Hash32(), and pcl::GenericImage< UInt8PixelTraits >::Hash32().

◆ Hash64()

uint64 pcl::Hash64 ( const void *  data,
size_type  size,
uint64  seed = 0 
)
inlinenoexcept

Computes a 64-bit non-cryptographic hash function.

Parameters
dataAddress of the first byte of the input data block.
sizeLength in bytes of the input data block.
seedOptional seed value for initialization of the hash function. If seed is zero or is not specified, the seed will be set equal to the length of the data block.

Returns a 64-bit hash value computed from the input data block.

Test vector: "The quick brown fox jumps over the lazy dog"
Hash64 checksum = 9a11f5e9468d7425
Test vector: "" (empty string)
Hash64 checksum = ef46db3751d8e999

This function implements the xxHash algorithm by Yann Collet. Our code is an adaptation of the original code by the author:

https://github.com/Cyan4973/xxHash

Copyright (C) 2012-2014, Yann Collet.
The original code has been released under the BSD 2-Clause License:

http://www.opensource.org/licenses/bsd-license.php

Definition at line 4750 of file Math.h.

Referenced by pcl::SortedArray< Node * >::Hash(), pcl::IndirectSortedArray< T, A >::Hash(), pcl::ReferenceSortedArray< FileDataCacheItem >::Hash(), pcl::GenericVector< bool >::Hash(), pcl::Array< GaiaStarData >::Hash(), pcl::IndirectArray< MetaObject >::Hash(), pcl::ReferenceArray< XMLNode >::Hash(), pcl::GenericMatrix< coefficient >::Hash(), pcl::GenericString< char, IsoCharTraits, PCL_STRING_ALLOCATOR >::Hash(), pcl::GenericImage< UInt8PixelTraits >::Hash(), pcl::GenericVector< bool >::Hash64(), pcl::Array< GaiaStarData >::Hash64(), pcl::GenericMatrix< coefficient >::Hash64(), pcl::GenericString< char, IsoCharTraits, PCL_STRING_ALLOCATOR >::Hash64(), and pcl::GenericImage< UInt8PixelTraits >::Hash64().