On Sun, Jun 26, 2011 at 01:11, Lorenzo Donati
<lorenzodonatibz@interfree.it> wrote:
Mmmmh, maybe mine it's weird thinking, but...:
since the hash algorithm is a Lua internal, and so unspecified, its
calculations could depend on the specific platforms Lua is compiled on (if
it relies on some standard C platform-dependent feature).
So if you embed in Lua source (which is cross-platform) an hash pre-computed
on a platform and run the code on a different platform you could get a
broken program!
More weirdness, I don't know if could be sane, but the hashing could even
depend on the specific run on a specific machine. I don't know Lua internals
very much, but the hashing algo could also take some address into account,
so the hashes could change according to the current memory layout of the
machine you the interpreter.
If my ramblings are completely wrong, someone please correct me!
-- Lorenzo
I'm willing to bet that the hashes probably don't involve anything
machine-specific, but from a cleanliness standpoint, you shouldn't
rely on anything undocumented. In other words, since the hashing
algorithm isn't described in the manual, you shouldn't assume anything
about it, including even seemingly safe assumptions like the hashes
won't depend on the machine. Even if it's true now, being undocumented
means it could change later, or in a different implementation.