WIP, abandoned: One-way backup tool with versioning and client-side encryption. Your precious data will never get lost!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
EternalArrowBackup/Source/Hasher/Sha256/Sha256ContentHasher.cs

23 lines
638 B

4 years ago
namespace EternalArrowBackup.Hasher.Sha256
{
using System.IO;
using System.Linq;
using System.Threading.Tasks;
7 years ago
using EternalArrowBackup.Hasher.Contracts;
4 years ago
public class Sha256ContentHasher : IContentHasher
{
public Task<string> ComputeHash(Stream content)
{
return Task.Run(() =>
{
4 years ago
using (var sha256 = System.Security.Cryptography.SHA256.Create())
{
4 years ago
var hash = sha256.ComputeHash(content);
return string.Concat(hash.Select(b => b.ToString("x2")));
}
});
}
}
}