public byte[] ComputeHash(byte[] data) { using (var facade = new GostCryptFacade(ProviderParams)) { facade.AcquireContext(null, Constants.CryptVerifycontext); using (HashContext hashContext = facade.CreateHash(null, 0)) { hashContext.AddData(data, 0); return(hashContext.GetValue()); } } }
/// <summary> /// Подсчет хэша. /// </summary> /// <param name="data">Данные.</param> /// <returns>Хэш.</returns> public static byte[] ComputeHash(byte[] data) { using (var container = new KeyContainer()) { container.AcquireContext(null, ProviderName, ProviderType, Constants.CryptVerifycontext); using (HashContext hashContext = container.CreateHash(null, Constants.CpcspHashId, 0)) { hashContext.AddData(data, 0); return(hashContext.GetValue()); } } }