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::GenericImage< P >::Hash32(), pcl::Array< T, A >::Hash32(), pcl::GenericMatrix< T >::Hash32(), pcl::GenericString< T, R, A >::Hash32(), and pcl::GenericVector< T >::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::GenericImage< P >::Hash(), pcl::IndirectArray< T, A >::Hash(), pcl::IndirectSortedArray< T, A >::Hash(), pcl::ReferenceArray< T, A >::Hash(), pcl::ReferenceSortedArray< T, A >::Hash(), pcl::SortedArray< T, A >::Hash(), pcl::Array< T, A >::Hash(), pcl::GenericMatrix< T >::Hash(), pcl::GenericString< T, R, A >::Hash(), pcl::GenericVector< T >::Hash(), pcl::GenericImage< P >::Hash64(), pcl::Array< T, A >::Hash64(), pcl::GenericMatrix< T >::Hash64(), pcl::GenericString< T, R, A >::Hash64(), and pcl::GenericVector< T >::Hash64().