I'm trying to come up with a good strategy for salting each row's column value in an SQL table with [semi-] independent salts for each cell. Ideally, I'd prefer a setup with only 1 secret salt per table, with the salt of each table-cell derived from (i.e. determined algorithmically) from that 1 secret salt.
The reason why I need a new salt per table-cell is that I need to advertise the hash of each column value without giving away its value. (I'll compute each cell's hash by concatenating the cell's value to its salt and then compute the hash of that byte sequence.)
A simple strategy I have in mind for generating the per-table-cell salt is to say generate a secret, secure 32-byte random byte sequence for table, call it R_32, and then for each cell compute the SHA-256 of R_32 concatenated with the cell's coordinates. In pseudo code:
salt(row,col) = SHA_256( R_32 + row + col)
where +
here represents byte-string concatenation (not addition).
This way, I can both advertise a table-cell's hash, and if necessary, later prove the contents of that cell generated the hash (by exposing only that cell's salt and it contents).
I'm a mathy programmer with some working (application-level) knowledge of cryptographic principles, but not a cryptographer. So 2 general questions:
Is the above
salt(row,col)
function secure? (I obviously think it should be, but there may be subtleties)I feel I can't be the first person tackling this problem of deriving multiple salts from a single secret salt. My searches come up naught however. Maybe they even wrote about it. If so, any pointers much appreciated.
Thank you