Esempio n. 1
0
        private bool IsKey(HashedValue potentialKey, int keyIndex, Func <int, HashedValue> hashGenerator)
        {
            var match = tripletPattern.Match(potentialKey.HexadecimalHash);

            if (match == Match.Empty)
            {
                return(false);
            }

            var tripletCharacter = match.Value.First();

            var quintupletPattern = new Regex(string.Format("{0}{0}{0}{0}{0}", tripletCharacter));

            foreach (var index in Enumerable.Range(keyIndex + 1, 1000))
            {
                var hash = hashGenerator(index);

                if (quintupletPattern.IsMatch(hash.HexadecimalHash))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 2
0
        public HashedValue Rehash(int count)
        {
            var value = this;

            foreach (var c in Enumerable.Range(0, count))
            {
                value = new HashedValue(value.HexadecimalHash);
            }

            return(value);
        }
Esempio n. 3
0
 public HashedValue(string value)
 {
     this.Value           = value;
     this.HexadecimalHash = HashedValue.Hash(this.Value);
 }