---
name: "rte_jhash_32b"
section: "3"
platform: "linux"
package: "dpdk-doc"
version: "24.11.4-0+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rte_jhash.h"
---

# rte\_jhash\_32b(3)

Part of [rte\_jhash.h(3)](/rte_jhash.h/3.md).

## NAME

rte\_jhash.h

## SYNOPSIS

`#include <stdint.h>`\
 `#include <string.h>`\
 `#include <limits.h>`\
 `#include <rte_config.h>`\
 `#include <rte_log.h>`\
 `#include <rte_byteorder.h>`\

### Macros

\#define **RTE\_JHASH\_GOLDEN\_RATIO**   0xdeadbeef\

### Functions

static void **rte\_jhash\_2hashes** (const void \*key, uint32\_t length, uint32\_t \*pc, uint32\_t \*pb)\
 static void **rte\_jhash\_32b\_2hashes** (const uint32\_t \*k, uint32\_t length, uint32\_t \*pc, uint32\_t \*pb)\
 static uint32\_t **rte\_jhash** (const void \*key, uint32\_t length, uint32\_t initval)\
 static uint32\_t **rte\_jhash\_32b** (const uint32\_t \*k, uint32\_t length, uint32\_t initval)\
 static uint32\_t **rte\_jhash\_3words** (uint32\_t a, uint32\_t b, uint32\_t c, uint32\_t initval)\
 static uint32\_t **rte\_jhash\_2words** (uint32\_t a, uint32\_t b, uint32\_t initval)\
 static uint32\_t **rte\_jhash\_1word** (uint32\_t a, uint32\_t initval)\

## Detailed Description

jhash functions.

Definition in file **rte\_jhash.h**.

## Macro Definition Documentation

### #define RTE\_JHASH\_GOLDEN\_RATIO 0xdeadbeef

The golden ratio: an arbitrary value.

Definition at line **68** of file **rte\_jhash.h**.

## Function Documentation

### static void rte\_jhash\_2hashes (const void \* key, uint32\_t length, uint32\_t \* pc, uint32\_t \* pb)` [inline]`, ` [static]`

Same as rte\_jhash, but takes two seeds and return two uint32\_ts. pc and pb must be non-null, and \*pc and \*pb must both be initialized with seeds. If you pass in (\*pb)=0, the output (\*pc) will be the same as the return value from rte\_jhash.

**Parameters**

*key* Key to calculate hash of. \
 *length* Length of key in bytes. \
 *pc* IN: seed OUT: primary hash value. \
 *pb* IN: second seed OUT: secondary hash value.

Definition at line **236** of file **rte\_jhash.h**.

### static void rte\_jhash\_32b\_2hashes (const uint32\_t \* k, uint32\_t length, uint32\_t \* pc, uint32\_t \* pb)` [inline]`, ` [static]`

Same as rte\_jhash\_32b, but takes two seeds and return two uint32\_ts. pc and pb must be non-null, and \*pc and \*pb must both be initialized with seeds. If you pass in (\*pb)=0, the output (\*pc) will be the same as the return value from rte\_jhash\_32b.

**Parameters**

*k* Key to calculate hash of. \
 *length* Length of key in units of 4 bytes. \
 *pc* IN: seed OUT: primary hash value. \
 *pb* IN: second seed OUT: secondary hash value.

Definition at line **257** of file **rte\_jhash.h**.

### static uint32\_t rte\_jhash (const void \* key, uint32\_t length, uint32\_t initval)` [inline]`, ` [static]`

The most generic version, hashes an arbitrary sequence of bytes. No alignment or length assumptions are made about the input key. For keys not aligned to four byte boundaries or a multiple of four bytes in length, the memory region just after may be read (but not used in the computation). This may cross a page boundary.

**Parameters**

*key* Key to calculate hash of. \
 *length* Length of key in bytes. \
 *initval* Initialising value of hash.

**Returns**

Calculated hash value.

Definition at line **280** of file **rte\_jhash.h**.

### static uint32\_t rte\_jhash\_32b (const uint32\_t \* k, uint32\_t length, uint32\_t initval)` [inline]`, ` [static]`

A special optimized version that handles 1 or more of uint32\_ts. The length parameter here is the number of uint32\_ts in the key.

**Parameters**

*k* Key to calculate hash of. \
 *length* Length of key in units of 4 bytes. \
 *initval* Initialising value of hash.

**Returns**

Calculated hash value.

Definition at line **303** of file **rte\_jhash.h**.

### static uint32\_t rte\_jhash\_3words (uint32\_t a, uint32\_t b, uint32\_t c, uint32\_t initval)` [inline]`, ` [static]`

A special ultra-optimized versions that knows it is hashing exactly 3 words.

**Parameters**

*a* First word to calculate hash of. \
 *b* Second word to calculate hash of. \
 *c* Third word to calculate hash of. \
 *initval* Initialising value of hash.

**Returns**

Calculated hash value.

Definition at line **340** of file **rte\_jhash.h**.

### static uint32\_t rte\_jhash\_2words (uint32\_t a, uint32\_t b, uint32\_t initval)` [inline]`, ` [static]`

A special ultra-optimized versions that knows it is hashing exactly 2 words.

**Parameters**

*a* First word to calculate hash of. \
 *b* Second word to calculate hash of. \
 *initval* Initialising value of hash.

**Returns**

Calculated hash value.

Definition at line **359** of file **rte\_jhash.h**.

### static uint32\_t rte\_jhash\_1word (uint32\_t a, uint32\_t initval)` [inline]`, ` [static]`

A special ultra-optimized versions that knows it is hashing exactly 1 word.

**Parameters**

*a* Word to calculate hash of. \
 *initval* Initialising value of hash.

**Returns**

Calculated hash value.

Definition at line **376** of file **rte\_jhash.h**.

## Author

Generated automatically by Doxygen for DPDK from the source code.
