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); }
public HashedValue Rehash(int count) { var value = this; foreach (var c in Enumerable.Range(0, count)) { value = new HashedValue(value.HexadecimalHash); } return(value); }
public HashedValue(string value) { this.Value = value; this.HexadecimalHash = HashedValue.Hash(this.Value); }