예제 #1
0
        string CreateHash(IList <object> values)
        {
            StringBuilder hashSet = new StringBuilder();
            IHashService  service = HashService.GetInstance();

            for (int index = 0; index < values.Count; index++)
            {
                object valueObj = values[index];

                hashSet.AppendLine(service.ComputeHashValue(Convert.ToString(valueObj)));
            }

            string accumulatedHash = service.ComputeHashValue(hashSet.ToString());

            return(accumulatedHash);
        }
예제 #2
0
        string ComputeHash(IDictionary <string, Tuple <PropertyInfo, object> > properties)
        {
            StringBuilder hashSet = new StringBuilder();
            IHashService  service = HashService.GetInstance();

            foreach (KeyValuePair <string, Tuple <PropertyInfo, object> > kvp in properties)
            {
                object value = kvp.Value.Item2;

                if (value == null)
                {
                    continue;
                }

                string hashValue = Convert.ToString(value);

                hashSet.AppendLine(service.ComputeHashValue(hashValue));
            }

            //Merkel tree???
            string accumulatedHash = service.ComputeHashValue(hashSet.ToString());

            return(accumulatedHash);
        }