simpleHash

生成字符串的简单哈希值

用法

simpleHash 函数用于生成字符串的简单哈希值。

import { simpleHash } from '@movk/core'

const hash1 = simpleHash('hello world')
console.log(hash1) // 'nf5xd4'

const hash2 = simpleHash('hello world')
console.log(hash1 === hash2) // true,相同字符串产生相同哈希

const hash3 = simpleHash('hello world!')
console.log(hash1 === hash3) // false,不同字符串产生不同哈希

API

simpleHash(str)

生成字符串的简单哈希值。

参数

str
string required
待哈希的字符串。

返回值

返回值
string
32 位哈希值转换为 36 进制字符串。

Changelog

b6146 — refactor: 统一源码文件命名为 camelCase

Copyright © 2024 - 2026 YiXuan - MIT License