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.
|
|
|
|
namespace EternalArrowBackup.Hasher.SHA1
|
|
|
|
|
{
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Contracts.ContentTransformations;
|
|
|
|
|
|
|
|
|
|
public class SHA1ContentHasher : IContentHasher
|
|
|
|
|
{
|
|
|
|
|
public Task<string> ComputeHash(byte[] content)
|
|
|
|
|
{
|
|
|
|
|
return Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
using (var sha1 = System.Security.Cryptography.SHA1.Create())
|
|
|
|
|
{
|
|
|
|
|
var hash = sha1.ComputeHash(content);
|
|
|
|
|
return string.Concat(hash.Select(b => b.ToString("x2")));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|