background preloader

Hashing

Facebook Twitter

Consistent-hashing

B-tree. The Halton Sequence. The Halton sequence can be used like a random number generator to produce points in the interval [0,1]. The Halton sequence is even less random than a random number generator; if you specify the index I of the Halton number you want, there is a formula for producing H(I). On the other hand, the Halton sequence does a better job of filling in the region, avoiding the large gaps that can occur with a random number generator. The idea is simple. We choose a base, let's say 2. As a normal person counts from I = 1, 2, 3, ... we take each value I, write it in base 2, and reverse the digits, including the decimal sign, and convert back to base 10: and so on. How can we program this?

The number I is input. To do this for base 3, just replace all the 2's by 3's. Now to get a "good" sequence of Halton points in 2D, we compute the X coordinates using a base of 2, and the Y coordinates using a base of 3. Back to the Voronoi Project page. Cuckoo hashing. Cuckoo hashing example. The arrows show the alternative location of each key. A new item would be inserted in the location of A by moving A to its alternative location, currently occupied by B, and moving B to its alternative location which is currently vacant. Insertion of a new item in the location of H would not succeed: Since H is part of a cycle (together with W), the new item would get kicked out again. Cuckoo hashing is a scheme in computer programming for resolving hash collisions of values of hash functions in a table, with worst-case constant lookup time. The name derives from the behavior of some species of cuckoo, where the cuckoo chick pushes the other eggs or young out of the nest when it hatches; analogously, inserting a new key into a cuckoo hashing table may push an older key to a different location in the table.

History[edit] Cuckoo hashing was first described by Rasmus Pagh and Flemming Friche Rodler in 2001.[1] Theory[edit] Example[edit] Cycle[edit] See also[edit] CMPH - C Minimal Perfect Hashing Library. Blog » Blog Archive » In rainbows. We get asked a lot about the colour-coding we give to places in Dopplr : what it represents, why we did it, how are the colours assigned. One of the main ‘atoms’ of Dopplr is unsurprisingly, place – so to make that run through the warp-and-weft of the user-interface, and our branding, was extremely important.

The Dopplr logo, (or ‘SparkLogo’ * as we sometimes like to call it) is the clearest example of this perhaps. As you add trips to different destinations, Dopplr’s logo becomes your logo, reflecting what you’re doing – right the way through to the ‘ favicon ‘ that shows up in the address field of most browsers. It also makes for a great blog badge… As well as the aesthetic delights we believe that city colours bring to the service, we’re using them as visual ‘ affordances ‘ – ways to create implicit meaning and usefulness in the user-interface. We’re going to be doing far more with the city colours to create affordances in the near-future… But how do we generate them? Stop using unsafe keyed hashes, use HMAC « root labs rdist. The HMAC construction turns a cryptographic hash algorithm into a keyed hash. It is commonly used for integrity protection when the sender and recipient share a secret key.

It was developed to address various problems with arbitrary keyed hash constructions. So why are developers still rolling their own? One of the original papers on keyed hash constructions describes the motivations for developing a standard for HMAC. In 1995, there was no standardization and cryptographers only worked from hunches as to what constituted a secure keyed hash. This paper summarized two known attacks on some common schemes that had evolved in the absence of a standard. The first construction the paper attacks is H(k || m), aka “secret prefix”. The second construction was H(m || k), aka “secret suffix”. The first attack is that secret suffix is weaker against offline second-preimage attacks. The other attack is much more powerful. MD5 has multiple demonstrated collisions. Tom White: Mixing with MD5. Cuckoo Hashing for Undergraduates. MIT’s Introduction to Algorithms, Lectures 7 and 8: Hashing - go. This is the fifth post in an article series about MIT's lecture course "Introduction to Algorithms.

" In this post I will review lectures seven and eight, which are on the topic of Hashing. Many applications require a dynamic set that supports dictionary operations insert, search, and delete. For example, a compiler for a computer language maintains a symbol table, in which the keys of elements are arbitrary strings that correspond to identifiers in the language. A hash table is an effective data structure for implementing dictionaries. Lectures seven and eight cover various implementation techniques of hash tables and hash functions. Lecture 7: Hashing I Lecture seven starts with the symbol-table problem -- given a table S, we'd like to insert an element into S, delete an element from S and search for an element in S.

The simplest solution to this problem is to use a direct-access (or direct-address) table. Using direct-address table, the dictionary operations are trivial to implement. PS.