2
Answers

database table security with varchar column

I have heard that table security for data stored in the table can be made by storing Hashbyte data in a column.

So anyone comes and change values manually in a  table will be identified and that record be ommited for further calculation

Need help on these areas

CREATE TABLE [dbo].[sample1](
code varchar(50) NULL,
[hashcol] varchar(100) NULL
) ON [PRIMARY]
GO

using  2012 VS and ADO .NET with sql server 2008

  1. this is my table and trying to insert hashbyte data to hashcol column from csharp application
  • HOW TO GENERATE HASHBYTE VALUE FROM CSHARP ?
I have used this

public static byte[] SHA512(String plaintext)
{
  // convert the passPhrase string into a byte array
  ASCIIEncoding AE = new ASCIIEncoding();
  byte[] passBuff = AE.GetBytes(plaintext);

  SHA512Managed hashVal = new SHA512Managed();
  byte[] passHash = hashVal.ComputeHash(passBuff);

  return passHash;
}
  •  need better guide/example


 2)how to regenerate hashcol value automatically if some one changed existing record?
3) how to compare 2 values , both old and existing hashed values from database and csharp application


Hope for some guide since I'm new to these security measures




      Answers (2)