summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-10-07 00:31:10 +0800
committerruki <[email protected]>2025-10-07 00:31:10 +0800
commit69caeb34da2be2d03a86752b144c75881fcabf8f (patch)
tree25d1efdc2d44d485782936e0e8023fc69e7436ac
parent75a5ae1bfbd0570819c9cab6e623f2f26db2e8a2 (diff)
use hash64 instead of hash32
-rw-r--r--xmake/core/base/hash.lua2
-rw-r--r--xmake/core/base/scheduler.lua2
-rw-r--r--xmake/core/sandbox/modules/import/core/sandbox/module.lua2
-rw-r--r--xmake/plugins/pack/nsis/main.lua5
-rw-r--r--xmake/rules/c++/modules/scanner.lua2
-rw-r--r--xmake/rules/c++/modules/support.lua3
6 files changed, 5 insertions, 11 deletions
diff --git a/xmake/core/base/hash.lua b/xmake/core/base/hash.lua
index b03b6d2a1..d08a7d93b 100644
--- a/xmake/core/base/hash.lua
+++ b/xmake/core/base/hash.lua
@@ -147,7 +147,7 @@ end
-- generate random32 hash
-- @note it is easy to trigger hash conflicts
function hash.rand32()
- if false then --hash._rand32 then
+ if hash._rand32 then
return hash._rand32()
else
return hash.strhash32(tostring(math.random()))
diff --git a/xmake/core/base/scheduler.lua b/xmake/core/base/scheduler.lua
index 8327af6e8..b11be7d4e 100644
--- a/xmake/core/base/scheduler.lua
+++ b/xmake/core/base/scheduler.lua
@@ -410,7 +410,7 @@ function scheduler:_co_curenvs_update(envs)
for _, key in ipairs(table.orderkeys(envs)) do
envs_hash = envs_hash .. key:upper() .. envs[key]
end
- envs_hash = hash.strhash32(envs_hash)
+ envs_hash = hash.strhash64(envs_hash)
self._CO_CURENVS_HASH = envs_hash
-- save the current directory for each coroutine
diff --git a/xmake/core/sandbox/modules/import/core/sandbox/module.lua b/xmake/core/sandbox/modules/import/core/sandbox/module.lua
index 3a50e862b..dd7dac16e 100644
--- a/xmake/core/sandbox/modules/import/core/sandbox/module.lua
+++ b/xmake/core/sandbox/modules/import/core/sandbox/module.lua
@@ -203,7 +203,7 @@ function core_sandbox_module._native_moduleinfo(module_fullpath, modulekind)
local projectdir = path.normalize(path.absolute(module_fullpath))
local programdir = path.normalize(os.programdir())
local modulename = path.basename(module_fullpath)
- local modulehash = hash.strhash32(projectdir)
+ local modulehash = hash.strhash64(projectdir)
local builddir
local is_global = false
local modulepath
diff --git a/xmake/plugins/pack/nsis/main.lua b/xmake/plugins/pack/nsis/main.lua
index 1c6019d00..793bed1cf 100644
--- a/xmake/plugins/pack/nsis/main.lua
+++ b/xmake/plugins/pack/nsis/main.lua
@@ -81,11 +81,6 @@ function _get_makensis()
return makensis, oldenvs
end
--- get unique tag
-function _get_unique_tag(content)
- return hash.strhash32(content)
-end
-
-- translate the file path
function _translate_filepath(package, filepath)
return filepath:replace(package:install_rootdir(), "$InstDir", {plain = true})
diff --git a/xmake/rules/c++/modules/scanner.lua b/xmake/rules/c++/modules/scanner.lua
index fa2c3b98b..818e37aa2 100644
--- a/xmake/rules/c++/modules/scanner.lua
+++ b/xmake/rules/c++/modules/scanner.lua
@@ -418,7 +418,7 @@ function _patch_sourcebatch(target, sourcebatch)
memcache:set2(target:fullname(), "cached_sourcebatch", sourcebatch)
local keys = #sourcebatch.sourcefiles > 0 and table.concat(sourcebatch.sourcefiles) or "_"
- local sum = hash.strhash32(keys)
+ local sum = hash.strhash64(keys)
local cached_sum = localcache:get2(target:fullname(), "sourcebatch_sum")
if not cached_sum or cached_sum ~= sum then
localcache:set2(target:fullname(), "sourcebatch_sum", sum)
diff --git a/xmake/rules/c++/modules/support.lua b/xmake/rules/c++/modules/support.lua
index 2bf44bf51..0f89d4e98 100644
--- a/xmake/rules/c++/modules/support.lua
+++ b/xmake/rules/c++/modules/support.lua
@@ -273,7 +273,6 @@ function load_moduleinfo(target, sourcefile)
if os.isfile(dependfile) then
local data = io.load(dependfile)
if data then
- print(dependfile, data)
moduleinfo = json.decode(data.moduleinfo)
moduleinfo.sourcefile = sourcefile
end
@@ -348,7 +347,7 @@ function modules_cachedir(target, opt)
end
function get_modulehash(sourcefile)
- return hash.strhash32(sourcefile)
+ return hash.strhash64(sourcefile)
end
function get_metafile(target, module)