public Data(string id, SideEnum side, string value, IHashStrategy hashStrategy) { this.Id = id; this.Side = side; this.Text = value; this._hash = hashStrategy.GetHashAsync(value).Result; }
public AvalancheTester(IHashStrategy <T> hashStrategy, IBitOperator <T> bitOperator, int numInputBytes, int numOutputBytes) { _hashStrategy = hashStrategy; _bitOperator = bitOperator; _numInputBytes = numInputBytes; _numOutputBytes = numOutputBytes; }
public Customized32HashedMap(IDictionary <K, V> items, IHashStrategy hasher, Transformer <K, byte[]> transformer, Equator <K> isEqual) : this(items == null ? DefaultCapacity : items.Count, hasher, transformer, isEqual) { Guarder.CheckNull(hasher, transformer, isEqual); if (null != items) { foreach (var item in items) { Add(item.Key, item.Value); } } }
public static int HashSolution(string salt, IHashStrategy hashStrategy) { var keys = new List <string>(); var hashCache = new Dictionary <int, string>(); string GetHash(int index) { if (!hashCache.ContainsKey(index)) { hashCache[index] = hashStrategy.Hash(salt + index); } return(hashCache[index]); } for (int index = 0;; index++) { var hash = hashStrategy.Hash(salt + index); var c = FirstRepeatedCharacter(hash, 3); if (c.HasValue) { for (int promoteIndex = index + 1; promoteIndex < index + 1000; promoteIndex++) { string promotionHash = GetHash(promoteIndex); var fiveC = Enumerable.Repeat(c.Value, 5); if (promotionHash.Contains(new string(fiveC.ToArray()))) { keys.Add(hash); if (keys.Count == 64) { return(index); } break; } } } } }
public DiffController(IHashStrategy hashStrategy, ICache cache) { this._hashStrategy = hashStrategy; this._cache = cache; }
public Customized32HashedMap(int capacity, IHashStrategy hasher, Transformer <K, byte[]> transformer, Equator <K> isEqual) : base(capacity, new EquatorComparer <K>(isEqual)) { transform = transformer; this.hasher = hasher; }
public byte[] hashContent(IHashStrategy hashStrategy) { return(hashStrategy.hash(raw)); }