diff options
| author | ruki <[email protected]> | 2025-09-30 22:43:05 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-09-30 22:43:05 +0800 |
| commit | 703dec087d98946bc2ba5384d2274e588f8ee96d (patch) | |
| tree | 27cc9c304c05c2916135b3afc2d8e4e51f828834 /xmake/core/base/hash.lua | |
| parent | 9dd7fe46d8678216b62016b721fe084d5bad9246 (diff) | |
improve strhash
Diffstat (limited to 'xmake/core/base/hash.lua')
| -rw-r--r-- | xmake/core/base/hash.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/xmake/core/base/hash.lua b/xmake/core/base/hash.lua index 362eb67e5..b40f7b885 100644 --- a/xmake/core/base/hash.lua +++ b/xmake/core/base/hash.lua @@ -104,12 +104,12 @@ end -- TODO, we should optimize it -- generate hash32 from string, e.g. "91e8ecf1" function hash.strhash32(str) - return hash.uuid4(str):split("-", {plain = true})[1]:lower() + return hash.xxhash64(bytes(str)):sub(1, 8) end -- generate hash128 from string, e.g. "91e8ecf1417f4edfa574e22d7d8d204a" function hash.strhash128(str) - return hash.uuid4(str):replace("-", "", {plain = true}):lower() + return hash.xxhash128(bytes(str)) end -- return module: hash |
