Does it make any sense at all to salt a hash which might be available publicly?
It doesn't really make sense to me, but does anyone actually do that?
UPDATE - Some more info:
An acquaintance of mine has a common salted-hash function which he uses throughout his code. So I was wondering if it made any sense at-all, to do so.
Here's the function he used:
hashlib.sha256(string+SALT).hexdigest()
Update2:
Sorry if it wasn't clear. By available publicly I meant, that it is rendered in the HTML of the project (for linking, etc) & can thus be easily read by a third party.
The project is a python based web-app which involves user-created pages which are tracked using their hashes like myproject.com/hash
so thus revealing the hash publicly. So my question is, whether in any circumstances would any sane programmer salt such a hash?
Question:
Using hashlib.sha256(string+SALT).hexdigest()
vs hashlib.sha256(string).hexdigest()
, when the hash isn't a secret.
rendered in the HTML of the project (for linking, etc)
doesn't makes sense to me. HTML for linking? (possibly because what your friend is doing doesn't make sense)... Edit the question and add in it every bit of detail you can think of. In strange situations there might be a very specific reason behind everything, but you'll have to give us the whole picture...