Intel® Integrated Performance Primitives Developer Guide and Reference

ID 790148
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Hash

DEPRECATED. Calculates the hash value for the string.

Syntax

IppStatus ippsHash_8u32u(const Ipp8u* pSrc, int len, Ipp32u* pHashVal);

IppStatus ippsHash_16u32u(const Ipp16u* pSrc, int len, Ipp32u* pHashVal);

IppStatus ippsHashSJ2_8u32u(const Ipp8u* pSrc, int len, Ipp32u* pHashVal);

IppStatus ippsHashSJ2_16u32u(const Ipp16u* pSrc, int len, Ipp32u* pHashVal);

IppStatus ippsHashMSCS_8u32u(const Ipp8u* pSrc, int len, Ipp32u* pHashVal);

IppStatus ippsHashMSCS_16u32u(const Ipp16u* pSrc, int len, Ipp32u* pHashVal);

Include Files

ippch.h

Domain Dependencies

Headers: ippcore.h, ippvm.h, ipps.h

Libraries: ippcore.lib, ippvm.lib, ipps.lib

Parameters

pSrc

Pointer to the source string.

len

Number of elements in the string.

pHashVal

Pointer to the result value.

Description

NOTE:
This function is deprecated and will be removed in a future release. If you have concerns, open a ticket and provide feedback at https://supporttickets.intel.com/.

This function produces the hash value pHasVal for the specified string pSrc. The hash value is fairly unique to the given string. If hash values of two strings are different, the strings are different as well. If the hush values are the same, the strings are probably identical. The hash value is calculated in the following manner: initial value is set to 0, then the hash value is calculated successively for each i-th string element as pHashVal[i] = 2* pHashVal[i-1]^ pSrc[i], where ^ denotes a bitwise exclusive OR (XOR) operator. The hash value for the last element is the hash value for the whole string.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error condition if one of the specified pointers is NULL.

ippStsLengthErr

Indicates an error condition if len is negative.

Example

The code example below shows how to use the functions ippsHash_8u32u, ippsHashSJ2_8u32u, and ippsHashMSCS_8u32u.

 
Ipp8u string[] = "monkey";
Ipp32u hash;
hash = 0;
ippsHash_8u32u( string, sizeof (string) - 1, &hash );
printf ( "ippsHash_8u32u hash value: %u\n", hash );
hash = 0;
ippsHashSJ2_8u32u( string, sizeof (string) - 1, &hash );
printf ( "ippsHashSJ2_8u32u hash value: %u\n", hash );
hash = 0;
ippsHashMSCS_8u32u( string, sizeof (string) - 1, &hash );
printf ( "ippsHashMSCS_8u32u hash value: %u\n", hash );

Output:

 
ippsHash_8u32u hash value: 2367
ippsHashSJ2_8u32u hash value: 3226471379
ippsHashMSCS_8u32u hash value: 1466279646