MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
DJB2哈希算法

Daniel J. Bernstein的DJB2哈希算法 更多...

函数

MSTL_CONSTEXPR14 size_t DJB2_hash (const char *str, const size_t len) noexcept
 DJB2哈希算法

详细描述

Daniel J. Bernstein的DJB2哈希算法

函数说明

◆ DJB2_hash()

MSTL_CONSTEXPR14 size_t DJB2_hash ( const char * str,
const size_t len )
noexcept

DJB2哈希算法

参数
str字符串指针
len字符串长度
返回
计算出的哈希值

DJB2是一种非加密哈希算法,具有以下特点:

  1. 实现简单
  2. 速度快
  3. 分布均匀

但在某些特殊情况下仍可能出现哈希冲突。

在文件 hash.hpp216 行定义.