diff options
| author | Saikari <[email protected]> | 2025-10-04 23:09:26 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-10-04 23:09:26 +0300 |
| commit | 4b643c4fa3792c834fe08d2e99104ea655b61584 (patch) | |
| tree | 6f3b868645d3555cdf4bb50d901533d6b57b31b1 /xmake/core/base/hash.lua | |
| parent | cb087738d9cc3caf04f619b2524d4a848daee387 (diff) | |
| parent | 82f581a047820d7136b7bf6b6a969b4d3a96e497 (diff) | |
Merge branch 'xmake-io:dev' into fix-sizeof-wasm
Diffstat (limited to 'xmake/core/base/hash.lua')
| -rw-r--r-- | xmake/core/base/hash.lua | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/xmake/core/base/hash.lua b/xmake/core/base/hash.lua index e846ba302..9d7ca40ed 100644 --- a/xmake/core/base/hash.lua +++ b/xmake/core/base/hash.lua @@ -120,9 +120,14 @@ end -- generate hash32 from string, e.g. "91e8ecf1" function hash.strhash32(str) - local data = libc.ptraddr(libc.dataptr(str)) - local size = #str - return hash._xxhash(32, data, size) + if hash._rand32 then + local data = libc.ptraddr(libc.dataptr(str)) + local size = #str + return hash._xxhash(32, data, size) + else + -- we need to be compatible with the old binary core (<= v3.0.3) + return hash.uuid4(str):split("-", {plain = true})[1]:lower() + end end -- generate hash64 from string, e.g. "91e8ecf191e8ecf1" |
