make open subtitle project portable

This commit is contained in:
Luke Pulverenti
2016-10-27 18:54:56 -04:00
parent 0d5e95222a
commit 31c8c3bf7f
16 changed files with 9229 additions and 86 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using MediaBrowser.Model.Cryptography;
@@ -8,10 +9,21 @@ namespace MediaBrowser.Common.Implementations.Cryptography
public class CryptographyProvider : ICryptographyProvider
{
public Guid GetMD5(string str)
{
return new Guid(GetMD5Bytes(str));
}
public byte[] GetMD5Bytes(string str)
{
using (var provider = MD5.Create())
{
return new Guid(provider.ComputeHash(Encoding.Unicode.GetBytes(str)));
return provider.ComputeHash(Encoding.Unicode.GetBytes(str));
}
}
public byte[] GetMD5Bytes(Stream str)
{
using (var provider = MD5.Create())
{
return provider.ComputeHash(str);
}
}
}