Browse Source

added aes-ni support to pearson hashing

pull/408/head
Logan007 4 years ago
parent
commit
5ed8560503
  1. 16
      src/pearson.c

16
src/pearson.c

@ -65,12 +65,6 @@ static const uint8_t t[256] ={
*/ */
static uint16_t t16[65536]; // 16-bit look-up table
#define ROR64(x,r) (((x)>>(r))|((x)<<(64-(r))))
#define ROR32(x,r) (((x)>>(r))|((x)<<(32-(r))))
#if defined (__AES__) && defined (__SSSE3__) // AES-NI & SSSE3 ---------------------------- #if defined (__AES__) && defined (__SSSE3__) // AES-NI & SSSE3 ----------------------------
@ -184,6 +178,12 @@ uint16_t pearson_hash_16 (const uint8_t *in, size_t len) {
#else // plain C -------------------------------------------------------------------------- #else // plain C --------------------------------------------------------------------------
static uint16_t t16[65536]; // 16-bit look-up table
#define ROR64(x,r) (((x)>>(r))|((x)<<(64-(r))))
#define ROR32(x,r) (((x)>>(r))|((x)<<(32-(r))))
void pearson_hash_256 (uint8_t *out, const uint8_t *in, size_t len) { void pearson_hash_256 (uint8_t *out, const uint8_t *in, size_t len) {
size_t i; size_t i;
@ -360,8 +360,12 @@ uint16_t pearson_hash_16 (const uint8_t *in, size_t len) {
void pearson_hash_init () { void pearson_hash_init () {
#if defined (__AES__) && (__SSSE3__)
#else
size_t i; size_t i;
for (i = 0; i < 65536; i++) for (i = 0; i < 65536; i++)
t16[i] = (t[i >> 8] << 8) + t[(uint8_t)i]; t16[i] = (t[i >> 8] << 8) + t[(uint8_t)i];
#endif
} }

Loading…
Cancel
Save