diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-10-27 18:54:56 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-10-27 18:54:56 -0400 |
| commit | 31c8c3bf7f1cb5e79d36b0b1d5c28907ea526011 (patch) | |
| tree | 3cb82628a3d58065d4f2b1bfecace002e5cb0b1e /MediaBrowser.Common.Implementations | |
| parent | 0d5e95222af2a40d06971baa5ab06a9e5d2fba3d (diff) | |
make open subtitle project portable
Diffstat (limited to 'MediaBrowser.Common.Implementations')
| -rw-r--r-- | MediaBrowser.Common.Implementations/Cryptography/CryptographyProvider.cs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/MediaBrowser.Common.Implementations/Cryptography/CryptographyProvider.cs b/MediaBrowser.Common.Implementations/Cryptography/CryptographyProvider.cs index 81cbaa3aae..67dbd76d24 100644 --- a/MediaBrowser.Common.Implementations/Cryptography/CryptographyProvider.cs +++ b/MediaBrowser.Common.Implementations/Cryptography/CryptographyProvider.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Security.Cryptography; using System.Text; using MediaBrowser.Model.Cryptography; @@ -9,9 +10,20 @@ namespace MediaBrowser.Common.Implementations.Cryptography { public Guid GetMD5(string str) { + return new Guid(GetMD5Bytes(str)); + } + public byte[] GetMD5Bytes(string str) + { + using (var provider = MD5.Create()) + { + return provider.ComputeHash(Encoding.Unicode.GetBytes(str)); + } + } + public byte[] GetMD5Bytes(Stream str) + { using (var provider = MD5.Create()) { - return new Guid(provider.ComputeHash(Encoding.Unicode.GetBytes(str))); + return provider.ComputeHash(str); } } } |
