예제 #1
0
        /**
         * This routine processes the passed chunk of data and updates the hash context based on it. If the 'finalize'
         * parameter is not set, then the length of the data passed in must be a multiple of 16. If the 'finalize' parameter
         * is set then the length can be any value up 1-16, and the final hash value will be calculated.
         *
         * @param code the integer array to hash
         * @return the resulting {@link EmberAesMmoHashContext}
         */
        public EmberAesMmoHashContext MmoHash(int[] code)
        {
            EmberAesMmoHashContext hashContext = new EmberAesMmoHashContext();

            hashContext.SetResult(new int[16]);
            hashContext.SetLength(0);
            EzspAesMmoHashRequest request = new EzspAesMmoHashRequest();

            request.SetContext(hashContext);
            request.SetData(code);
            request.SetFinalize(true);
            request.SetLength(code.Length);
            IEzspTransaction       transaction = _protocolHandler.SendEzspTransaction(new EzspSingleResponseTransaction(request, typeof(EzspAesMmoHashResponse)));
            EzspAesMmoHashResponse response    = (EzspAesMmoHashResponse)transaction.GetResponse();

            _lastStatus = response.GetStatus();
            Log.Debug(response.ToString());
            if (response.GetStatus() != EmberStatus.EMBER_SUCCESS)
            {
                Log.Debug("Error performing AES MMO hash: {}", response);
            }

            return(response.GetReturnContext());
        }
예제 #2
0
 /// <summary>
 /// The context to set as <see cref="EmberAesMmoHashContext"/> </summary>
 public void SetContext(EmberAesMmoHashContext context)
 {
     _context = context;
 }
예제 #3
0
 /// <summary>
 /// The returnContext to set as <see cref="EmberAesMmoHashContext"/> </summary>
 public void SetReturnContext(EmberAesMmoHashContext returnContext)
 {
     _returnContext = returnContext;
 }
예제 #4
0
 public EzspAesMmoHashResponse(int[] inputBuffer) :
     base(inputBuffer)
 {
     _status        = deserializer.DeserializeEmberStatus();
     _returnContext = deserializer.DeserializeEmberAesMmoHashContext();
 }
예제 #5
0
 public void SerializeEmberAesMmoHashContext(EmberAesMmoHashContext context)
 {
     context.Serialize(this);
 }