From 0d10dfe4718dc6875a20fc7c0c3d0b8b982cf3d8 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 7 Jul 2017 23:12:21 -0400 Subject: update sharpcifs --- .../IO/SharpCifs/Util/HMACT64.cs | 186 ++++++++++----------- 1 file changed, 93 insertions(+), 93 deletions(-) (limited to 'Emby.Common.Implementations/IO/SharpCifs/Util/HMACT64.cs') diff --git a/Emby.Common.Implementations/IO/SharpCifs/Util/HMACT64.cs b/Emby.Common.Implementations/IO/SharpCifs/Util/HMACT64.cs index fff978fafa..9ab31d61b8 100644 --- a/Emby.Common.Implementations/IO/SharpCifs/Util/HMACT64.cs +++ b/Emby.Common.Implementations/IO/SharpCifs/Util/HMACT64.cs @@ -19,99 +19,99 @@ using SharpCifs.Util.Sharpen; namespace SharpCifs.Util { - /// This is an implementation of the HMACT64 keyed hashing algorithm. - /// - /// This is an implementation of the HMACT64 keyed hashing algorithm. - /// HMACT64 is defined by Luke Leighton as a modified HMAC-MD5 (RFC 2104) - /// in which the key is truncated at 64 bytes (rather than being hashed - /// via MD5). - /// - public class Hmact64 : MessageDigest - { - private const int BlockLength = 64; - - private const byte Ipad = unchecked(unchecked(0x36)); - - private const byte Opad = unchecked(unchecked(0x5c)); - - private MessageDigest _md5; - - private byte[] _ipad = new byte[BlockLength]; - - private byte[] _opad = new byte[BlockLength]; - - /// Creates an HMACT64 instance which uses the given secret key material. - /// Creates an HMACT64 instance which uses the given secret key material. - /// The key material to use in hashing. - public Hmact64(byte[] key) - { - int length = Math.Min(key.Length, BlockLength); - for (int i = 0; i < length; i++) - { - _ipad[i] = unchecked((byte)(key[i] ^ Ipad)); - _opad[i] = unchecked((byte)(key[i] ^ Opad)); - } - for (int i1 = length; i1 < BlockLength; i1++) - { - _ipad[i1] = Ipad; - _opad[i1] = Opad; - } - try - { - _md5 = GetInstance("MD5"); - } - catch (Exception ex) - { - throw new InvalidOperationException(ex.Message); - } - EngineReset(); - } - - - protected byte[] EngineDigest() - { - byte[] digest = _md5.Digest(); - _md5.Update(_opad); - return _md5.Digest(digest); - } - - protected int EngineDigest(byte[] buf, int offset, int len) - { - byte[] digest = _md5.Digest(); - _md5.Update(_opad); - _md5.Update(digest); - try - { - _md5.Digest(buf, offset, len); - - return len; - } - catch (Exception) - { - throw new InvalidOperationException(); - } - } - - protected int EngineGetDigestLength() - { - return _md5.GetDigestLength(); - } - - protected void EngineReset() - { - _md5.Reset(); - _md5.Update(_ipad); - } - - protected void EngineUpdate(byte b) - { - _md5.Update(b); - } - - protected void EngineUpdate(byte[] input, int offset, int len) - { - _md5.Update(input, offset, len); - } + /// This is an implementation of the HMACT64 keyed hashing algorithm. + /// + /// This is an implementation of the HMACT64 keyed hashing algorithm. + /// HMACT64 is defined by Luke Leighton as a modified HMAC-MD5 (RFC 2104) + /// in which the key is truncated at 64 bytes (rather than being hashed + /// via MD5). + /// + public class Hmact64 : MessageDigest + { + private const int BlockLength = 64; + + private const byte Ipad = unchecked(unchecked(0x36)); + + private const byte Opad = unchecked(unchecked(0x5c)); + + private MessageDigest _md5; + + private byte[] _ipad = new byte[BlockLength]; + + private byte[] _opad = new byte[BlockLength]; + + /// Creates an HMACT64 instance which uses the given secret key material. + /// Creates an HMACT64 instance which uses the given secret key material. + /// The key material to use in hashing. + public Hmact64(byte[] key) + { + int length = Math.Min(key.Length, BlockLength); + for (int i = 0; i < length; i++) + { + _ipad[i] = unchecked((byte)(key[i] ^ Ipad)); + _opad[i] = unchecked((byte)(key[i] ^ Opad)); + } + for (int i1 = length; i1 < BlockLength; i1++) + { + _ipad[i1] = Ipad; + _opad[i1] = Opad; + } + try + { + _md5 = GetInstance("MD5"); + } + catch (Exception ex) + { + throw new InvalidOperationException(ex.Message); + } + EngineReset(); + } + + + protected byte[] EngineDigest() + { + byte[] digest = _md5.Digest(); + _md5.Update(_opad); + return _md5.Digest(digest); + } + + protected int EngineDigest(byte[] buf, int offset, int len) + { + byte[] digest = _md5.Digest(); + _md5.Update(_opad); + _md5.Update(digest); + try + { + _md5.Digest(buf, offset, len); + + return len; + } + catch (Exception) + { + throw new InvalidOperationException(); + } + } + + protected int EngineGetDigestLength() + { + return _md5.GetDigestLength(); + } + + protected void EngineReset() + { + _md5.Reset(); + _md5.Update(_ipad); + } + + protected void EngineUpdate(byte b) + { + _md5.Update(b); + } + + protected void EngineUpdate(byte[] input, int offset, int len) + { + _md5.Update(input, offset, len); + } public override byte[] Digest() { -- cgit v1.2.3