\doxysection{include/osmocom/core/jhash.h File Reference}
\label{jhash_8h}\index{include/osmocom/core/jhash.h@{include/osmocom/core/jhash.h}}
{\ttfamily \#include $<$osmocom/core/bit32gen.\+h$>$}\newline
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmo\+\_\+unaligned\+\_\+cpu32}
\end{DoxyCompactItemize}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ OSMO\+\_\+\+JHASH\+\_\+\+MIX}(a,  b,  \textbf{ c})
\item 
\#define \textbf{ OSMO\+\_\+\+JHASH\+\_\+\+FINAL}(a,  b,  \textbf{ c})
\item 
\#define \textbf{ JHASH\+\_\+\+INITVAL}~0xdeadbeef
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static uint32\+\_\+t \textbf{ osmo\+\_\+rol32} (uint32\+\_\+t word, unsigned int shift)
\begin{DoxyCompactList}\small\item\em rol32 -\/ rotate a 32-\/bit value left @word\+: value to rotate @shift\+: bits to roll \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+unaligned\+\_\+cpu32} \textbf{ \+\_\+\+\_\+attribute\+\_\+\+\_\+} ((\+\_\+\+\_\+packed\+\_\+\+\_\+))
\item 
static uint32\+\_\+t \textbf{ osmo\+\_\+get\+\_\+unaligned\+\_\+cpu32} (const void $\ast$p)
\item 
static uint32\+\_\+t \textbf{ osmo\+\_\+jhash} (const void $\ast$key, uint32\+\_\+t \textbf{ length}, uint32\+\_\+t initval)
\item 
static uint32\+\_\+t \textbf{ osmo\+\_\+jhash2} (const uint32\+\_\+t $\ast$\textbf{ k}, uint32\+\_\+t \textbf{ length}, uint32\+\_\+t initval)
\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
uint32\+\_\+t \textbf{ x}
\end{DoxyCompactItemize}


\doxysubsection{Macro Definition Documentation}
\mbox{\label{jhash_8h_a30719fa01864f1c0d625b0c8f9c452d2}} 
\index{jhash.h@{jhash.h}!JHASH\_INITVAL@{JHASH\_INITVAL}}
\index{JHASH\_INITVAL@{JHASH\_INITVAL}!jhash.h@{jhash.h}}
\doxysubsubsection{JHASH\_INITVAL}
{\footnotesize\ttfamily \#define JHASH\+\_\+\+INITVAL~0xdeadbeef}

\mbox{\label{jhash_8h_ace92b14ebb5a376c7f379d97f9d0bdd3}} 
\index{jhash.h@{jhash.h}!OSMO\_JHASH\_FINAL@{OSMO\_JHASH\_FINAL}}
\index{OSMO\_JHASH\_FINAL@{OSMO\_JHASH\_FINAL}!jhash.h@{jhash.h}}
\doxysubsubsection{OSMO\_JHASH\_FINAL}
{\footnotesize\ttfamily \#define OSMO\+\_\+\+JHASH\+\_\+\+FINAL(\begin{DoxyParamCaption}\item[{}]{a,  }\item[{}]{b,  }\item[{}]{\textbf{ c} }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\{                                               \(\backslash\)}
\DoxyCodeLine{        c \string^= b; c -\/= osmo\_rol32(b, 14);              \(\backslash\)}
\DoxyCodeLine{        a \string^= c; a -\/= osmo\_rol32(c, 11);              \(\backslash\)}
\DoxyCodeLine{        b \string^= a; b -\/= osmo\_rol32(a, 25);               \(\backslash\)}
\DoxyCodeLine{        c \string^= b; c -\/= osmo\_rol32(b, 16);              \(\backslash\)}
\DoxyCodeLine{        a \string^= c; a -\/= osmo\_rol32(c, 4);               \(\backslash\)}
\DoxyCodeLine{        b \string^= a; b -\/= osmo\_rol32(a, 14);               \(\backslash\)}
\DoxyCodeLine{        c \string^= b; c -\/= osmo\_rol32(b, 24);              \(\backslash\)}
\DoxyCodeLine{\}}

\end{DoxyCode}
\mbox{\label{jhash_8h_a1781b7bf17ac19cd2bba7d36929455f9}} 
\index{jhash.h@{jhash.h}!OSMO\_JHASH\_MIX@{OSMO\_JHASH\_MIX}}
\index{OSMO\_JHASH\_MIX@{OSMO\_JHASH\_MIX}!jhash.h@{jhash.h}}
\doxysubsubsection{OSMO\_JHASH\_MIX}
{\footnotesize\ttfamily \#define OSMO\+\_\+\+JHASH\+\_\+\+MIX(\begin{DoxyParamCaption}\item[{}]{a,  }\item[{}]{b,  }\item[{}]{\textbf{ c} }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\{                                               \(\backslash\)}
\DoxyCodeLine{        a -\/= c;  a \string^= osmo\_rol32(c, 4);  c += b;    \(\backslash\)}
\DoxyCodeLine{        b -\/= a;  b \string^= osmo\_rol32(a, 6);  a += c;     \(\backslash\)}
\DoxyCodeLine{        c -\/= b;  c \string^= osmo\_rol32(b, 8);  b += a;     \(\backslash\)}
\DoxyCodeLine{        a -\/= c;  a \string^= osmo\_rol32(c, 16); c += b;    \(\backslash\)}
\DoxyCodeLine{        b -\/= a;  b \string^= osmo\_rol32(a, 19); a += c;     \(\backslash\)}
\DoxyCodeLine{        c -\/= b;  c \string^= osmo\_rol32(b, 4);  b += a;     \(\backslash\)}
\DoxyCodeLine{\}}

\end{DoxyCode}


\doxysubsection{Function Documentation}
\mbox{\label{jhash_8h_aa5d1ad1bcbb1bcf8ecb0b48d444bacaf}} 
\index{jhash.h@{jhash.h}!\_\_attribute\_\_@{\_\_attribute\_\_}}
\index{\_\_attribute\_\_@{\_\_attribute\_\_}!jhash.h@{jhash.h}}
\doxysubsubsection{\_\_attribute\_\_()}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+unaligned\+\_\+cpu32} \+\_\+\+\_\+attribute\+\_\+\+\_\+ (\begin{DoxyParamCaption}\item[{(\+\_\+\+\_\+packed\+\_\+\+\_\+)}]{ }\end{DoxyParamCaption})}

\mbox{\label{jhash_8h_aa4e572e223c95fe41e71b40c0540d170}} 
\index{jhash.h@{jhash.h}!osmo\_get\_unaligned\_cpu32@{osmo\_get\_unaligned\_cpu32}}
\index{osmo\_get\_unaligned\_cpu32@{osmo\_get\_unaligned\_cpu32}!jhash.h@{jhash.h}}
\doxysubsubsection{osmo\_get\_unaligned\_cpu32()}
{\footnotesize\ttfamily static uint32\+\_\+t osmo\+\_\+get\+\_\+unaligned\+\_\+cpu32 (\begin{DoxyParamCaption}\item[{const void $\ast$}]{p }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



References \textbf{ osmo\+\_\+unaligned\+\_\+cpu32\+::x}.



Referenced by \textbf{ osmo\+\_\+jhash()}.

\mbox{\label{jhash_8h_a300e8c1fafb2446940eeff90c148d992}} 
\index{jhash.h@{jhash.h}!osmo\_jhash@{osmo\_jhash}}
\index{osmo\_jhash@{osmo\_jhash}!jhash.h@{jhash.h}}
\doxysubsubsection{osmo\_jhash()}
{\footnotesize\ttfamily static uint32\+\_\+t osmo\+\_\+jhash (\begin{DoxyParamCaption}\item[{const void $\ast$}]{key,  }\item[{uint32\+\_\+t}]{length,  }\item[{uint32\+\_\+t}]{initval }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



References \textbf{ c}, \textbf{ JHASH\+\_\+\+INITVAL}, \textbf{ k}, \textbf{ length}, \textbf{ osmo\+\_\+get\+\_\+unaligned\+\_\+cpu32()}, \textbf{ OSMO\+\_\+\+JHASH\+\_\+\+FINAL}, and \textbf{ OSMO\+\_\+\+JHASH\+\_\+\+MIX}.

\mbox{\label{jhash_8h_a91ed52d475321230d7b8fcad13403a9f}} 
\index{jhash.h@{jhash.h}!osmo\_jhash2@{osmo\_jhash2}}
\index{osmo\_jhash2@{osmo\_jhash2}!jhash.h@{jhash.h}}
\doxysubsubsection{osmo\_jhash2()}
{\footnotesize\ttfamily static uint32\+\_\+t osmo\+\_\+jhash2 (\begin{DoxyParamCaption}\item[{const uint32\+\_\+t $\ast$}]{k,  }\item[{uint32\+\_\+t}]{length,  }\item[{uint32\+\_\+t}]{initval }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



References \textbf{ c}, \textbf{ JHASH\+\_\+\+INITVAL}, \textbf{ k}, \textbf{ length}, \textbf{ OSMO\+\_\+\+JHASH\+\_\+\+FINAL}, and \textbf{ OSMO\+\_\+\+JHASH\+\_\+\+MIX}.

\mbox{\label{jhash_8h_a4e7d955108efa003ae2b5485cca4450a}} 
\index{jhash.h@{jhash.h}!osmo\_rol32@{osmo\_rol32}}
\index{osmo\_rol32@{osmo\_rol32}!jhash.h@{jhash.h}}
\doxysubsubsection{osmo\_rol32()}
{\footnotesize\ttfamily static uint32\+\_\+t osmo\+\_\+rol32 (\begin{DoxyParamCaption}\item[{uint32\+\_\+t}]{word,  }\item[{unsigned int}]{shift }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



rol32 -\/ rotate a 32-\/bit value left @word\+: value to rotate @shift\+: bits to roll 



\doxysubsection{Variable Documentation}
\mbox{\label{jhash_8h_aae8a40a17c0be29c1f06ca6b4f9e2235}} 
\index{jhash.h@{jhash.h}!x@{x}}
\index{x@{x}!jhash.h@{jhash.h}}
\doxysubsubsection{x}
{\footnotesize\ttfamily uint32\+\_\+t x}



Referenced by \textbf{ \+\_\+\+\_\+attribute\+\_\+\+\_\+()}, \textbf{ leading\+\_\+bits()}, \textbf{ osmo\+\_\+base64\+\_\+decode()}, \textbf{ osmo\+\_\+bit\+\_\+reversal()}, \textbf{ osmo\+\_\+constant\+\_\+time\+\_\+cmp()}, \textbf{ osmo\+\_\+isqrt32()}, \textbf{ osmo\+\_\+revbytebits\+\_\+32()}, \textbf{ osmo\+\_\+revbytebits\+\_\+8()}, \textbf{ osmo\+\_\+store16be()}, \textbf{ osmo\+\_\+store16be\+\_\+ext()}, \textbf{ osmo\+\_\+store16le()}, \textbf{ osmo\+\_\+store16le\+\_\+ext()}, \textbf{ osmo\+\_\+store32be()}, \textbf{ osmo\+\_\+store32be\+\_\+ext()}, \textbf{ osmo\+\_\+store32le()}, \textbf{ osmo\+\_\+store32le\+\_\+ext()}, \textbf{ osmo\+\_\+store64be()}, \textbf{ osmo\+\_\+store64be\+\_\+ext()}, \textbf{ osmo\+\_\+store64le()}, and \textbf{ osmo\+\_\+store64le\+\_\+ext()}.

