File: jody_hash_simd.c

package info (click to toggle)
libjodycode 4.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,676 kB
  • sloc: ansic: 2,820; makefile: 372; sh: 160; xml: 37
file content (27 lines) | stat: -rw-r--r-- 848 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* Jody Bruchon's fast hashing function
 *
 * This function was written to generate a fast hash that also has a
 * fairly low collision rate. The collision rate is much higher than
 * a secure hash algorithm, but the calculation is drastically simpler
 * and faster.
 *
 * Copyright (C) 2014-2026 by Jody Bruchon <jody@jodybruchon.com>
 * Released under The MIT License
 */

#include <stdlib.h>
#include "jody_hash.h"
#include "jody_hash_simd.h"

#if (!defined NO_SSE2 || !defined NO_AVX2)
const union UINT256 vec_constant = {
	.v64[0] = JODY_HASH_CONSTANT,
	.v64[1] = JODY_HASH_CONSTANT,
	.v64[2] = JODY_HASH_CONSTANT,
	.v64[3] = JODY_HASH_CONSTANT };
const union UINT256 vec_constant_ror2 = {
	.v64[0] = JODY_HASH_CONSTANT_ROR2,
	.v64[1] = JODY_HASH_CONSTANT_ROR2,
	.v64[2] = JODY_HASH_CONSTANT_ROR2,
	.v64[3] = JODY_HASH_CONSTANT_ROR2 };
#endif