{"action":"opened","issue":{"url":"https://api.github.com/repos/trevp/noise/issues/21","labels_url":"https://api.github.com/repos/trevp/noise/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/trevp/noise/issues/21/comments","events_url":"https://api.github.com/repos/trevp/noise/issues/21/events","html_url":"https://github.com/trevp/noise/issues/21","id":108179671,"number":21,"title":"Use of HASH for sensitive and non-sensitive data","user":{"login":"stouset","id":4338,"avatar_url":"https://avatars.githubusercontent.com/u/4338?v=3","gravatar_id":"","url":"https://api.github.com/users/stouset","html_url":"https://github.com/stouset","followers_url":"https://api.github.com/users/stouset/followers","following_url":"https://api.github.com/users/stouset/following{/other_user}","gists_url":"https://api.github.com/users/stouset/gists{/gist_id}","starred_url":"https://api.github.com/users/stouset/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stouset/subscriptions","organizations_url":"https://api.github.com/users/stouset/orgs","repos_url":"https://api.github.com/users/stouset/repos","events_url":"https://api.github.com/users/stouset/events{/privacy}","received_events_url":"https://api.github.com/users/stouset/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-24T17:47:08Z","updated_at":"2015-09-24T17:47:08Z","closed_at":null,"body":"I'm writing an implementation in Rust that uses [libsodium's memory allocator](http://doc.libsodium.org/helpers/memory_management.html) to prevent sensitive data from being leaked. In most cases, this is straightforward to implement with Noise: `GetKey(k, n)` for example accepts a key that resides in protected memory, a nonce, and returns another key in protected memory.\r\n\r\n`HASH(data)` is (so far as I have found) the exception to this. The input and output are both *sometimes* sensitive data (when called via `MixKey` when `has_key == False`.\r\n\r\nIt would cost an extra hash operation to replace this one case with `HMAC-HASH(data, \"\")`. In my case, the benefit is that I don't have to either implement `HASH` using a slower approach that uses protected memory (not just for the input and output, but also for the hash state itself)."}}