ASP.NET Hash List<int>
I am creating a WebForms application in a ajax call I create a small List (which can vary in size) that I send back as a JSON object. In the object that I return via JSON I would like to include a hash value to make sure that when I send that list off in the next step, I can check that none of these values have been tampered with. I am using C#'s SHA256 implementation and would like to know the best way to hash this list of integers with a secret key. Any ideas? Thank you again for all of yo开发者_开发百科ur help and responses.
Just for completeness I will let everyone know my solutions as it may help someone in the future.
What I did was since this list of integers represent ID values, I ended up saving these in the database since I was to need them later anyways. This created a one to many association where I then hashed the ID value of the parent record that housed these association records. I used @Cipher comment about using HMAC to make sure that there can't be any tampering of this value. This allows me to store a large list of these items that I would need to be able to retrieve later anyways.
Thank you for your input and hope this may help someone in the future.
may be this helps you in what you are trying to do
JSON encryption envelope
精彩评论