Update groupcaps_hash function to minetest.sha1

This commit is contained in:
Elias Åström 2022-02-12 20:08:03 +01:00
parent a6c5c8a72a
commit 4ca89cfcae

View file

@ -2,10 +2,7 @@ local groupcaps_cache = {}
-- Compute a hash value. -- Compute a hash value.
function compute_hash(value) function compute_hash(value)
-- minetest.get_password_hash is quite fast, even if it uses a return string.sub(minetest.sha1(minetest.serialize(value)), 1, 8)
-- cryptographic hashing function (SHA-1). It is written in C++ and it
-- is probably hard to write a faster hashing function in Lua.
return string.sub(minetest.get_password_hash("ryvnf", minetest.serialize(value)), 1, 8)
end end
-- Get the groupcaps and hash for an enchanted tool. If this function is called -- Get the groupcaps and hash for an enchanted tool. If this function is called