mirror of
https://github.com/sphildreth/roadie
synced 2024-12-03 09:29:13 +00:00
29 lines
No EOL
776 B
C#
29 lines
No EOL
776 B
C#
using Roadie.Library.Imaging;
|
|
using System;
|
|
using System.Linq;
|
|
|
|
namespace Roadie.Library.Data
|
|
{
|
|
public partial class Image
|
|
{
|
|
public string Etag
|
|
{
|
|
get
|
|
{
|
|
using (var md5 = System.Security.Cryptography.MD5.Create())
|
|
{
|
|
return String.Concat(md5.ComputeHash(System.Text.Encoding.Default.GetBytes(string.Format("{0}{1}", this.RoadieId, this.LastUpdated))).Select(x => x.ToString("D2")));
|
|
}
|
|
}
|
|
}
|
|
|
|
public string GenerateSignature()
|
|
{
|
|
if (this.Bytes == null || !this.Bytes.Any())
|
|
{
|
|
return null;
|
|
}
|
|
return ImageHasher.AverageHash(this.Bytes).ToString();
|
|
}
|
|
}
|
|
} |