1. codernity
  2. CodernityDB
Issue #11 new

Please add a base class for MD5-hashed indexes

htgoebel
created an issue

As far as I've seen from the docs, hashing by MD5 is the most common method for indexing strings.

Please provide a MD5HashIndex class or a mix-in. The code is already there in the CodernityDB documentation.

BTW: Why are many of the examples there are using hexdigest while (binary) digest would suffice?

Comments (1)

  1. codernity repo owner

    Yes definitely hashing with md5 is quite frequently used method of creating key/value pairs.

    The problem with some kind of mix-in would be that you would still need to implement make_key and make_key_value yourself, because you have to specify a key. If you want to have "simple" md5 index, then just use http://labs.codernity.com/codernitydb/database_indexes.html#easier-way-of-creating-indexes like:

    name = Test
    type = HashIndex
    key_format = 16s
    
    make_key_value:
    md5(a),None
    
    make_key:
    md5(key)
    

    And you're right about hexdigest vs digest. But as you can see in our internal things we use digest, so it's just a documentation error (will be fixed though), but there are 2 examples of hexdigest while rest of them uses digest.

    Does it suits you ?

  2. Log in to comment