Discuss this help topic in SecureBlackbox Forum
Calculate hash over data
To calculate hash over some data (often called a 'message digest'), use the TElHashFunction component:
TElHashFunction hf = new TElHashFunction(SBConstants.Unit.SB_ALGORITHM_DGST_SHA256);
byte[] text1 = Encoding.UTF8.GetBytes("The lazy dog jumps over the quick brown fox");
hf.Update(text1, 0, text1.Length);
byte[] text2 = Encoding.UTF8.GetBytes(" ...leaving the fox puzzled");
hf.Update(text2, 0, text2.Length);
byte[] digest = hf.Finish();
That's it, the digest contains the desired value.
byte[] digest = TElHashFunction.Hash(SBConstants.Unit.SB_ALGORITHM_DGST_SHA256, Encoding.UTF8.GetBytes("Anyone seen the fox around at all?!"));