I am looking for replica of CHECKSUM MS SQL function in c#. When I fetch data in IDataReader, I want to convert one column from plain sting to hashed string using SqlFunctions.Checksum method.
Sample code:
IDataReader reader = base.DataBase.ExecuteReader(cmd);
var dsList = new List<IHumanReadableData>();
dsList = _humanReadableDataObjectMapper.MapList(reader);
dsList.ForEach(r => {
r.PersonName = SqlFunctions.Checksum(r.PersonName).ToString();
});
This snippet getting an error: "this function can only be invoked from LINQ to Entities".
Note:
I don't want to use standard hash algorithms coz I don't want a long hash string to be generated.
I want a hashed but relatively smaller string so that my users can compare them without I being exposing them sensitive data (i.e. PersonName).
I don't want to perform this operation from MS SQL using CHECKSUM function.
Any ideas ??