Closed jaromil closed 5 months ago
Script to reproduce:
claims = { "I am over 18",
"Born in Pescara",
"Resident in Pizzoferrato",
"C level English speaker",
"Elite Startfighter pilot" }
H = ECP.hashtopoint
mask = ECP.random()
hashed_claims = deepmap(H, claims)
masked_claims = { }
for _,v in sort_pairs(hashed_claims) do
masked_claims[v] = v + mask
end
for k,v in sort_pairs(masked_claims) do
I.print({k=k,v=v})
end
Good candidate to fix this is the pure-lua qsort implementation here https://github.com/DarkRoku12/lua_sort
Else another solution can be to implement the zenroom.ECP
comparison, but that may be misleading: does it compares octet-rendered byte content or x/y coordinates of points?
The adoption of vanilla
table.sort
from lua here: https://github.com/dyne/Zenroom/blob/6262bc2904e60b68a463740f9516feb6b2c45d32/src/lua/zenroom_common.lua#L110Breaks the deterministic sorting of tables in case they are dictionaries and the keys are a
zenroom.
type.We need to implement our own sort to support also zenroom types (it can be over octet bytes).