Page MenuHome GnuPG

Missing function to calculate wkdhash
Closed, WontfixPublic

Description

There is no method available (at least in the python interface) to calculate the wkdhash. It would help a lot if such function would be availalbe to write own wkd scripts.
Andre already made an implementation for z32_encode under https://hg.intevation.de/gnupg/wkd-tools/file/tip/generate-openpgpkey-hu

Here is a function with doctests, that creates the concrete way gnupg is using this:

def wkdhash(data):                                 
    """
    >>> wkdkey(b"beowulf") == "jfqu6nreit1eb7xiyf45r73af4ftgwse"
    True                                    
    >>> wkdkey(b"daniel") == "8w8uz8qhiusdbtyyttxygducnq18t14x"
    True                                                          
    >>> wkdkey(b"mail") == "dizb37aqa5h4skgu7jf1xjr4q71w4paq"                        
    True                                                                                                           
    >>> wkdkey(b"Joe.Doe") == "iy9q119eutrkn8s1mk4r39qejnbu3n5q"                                                                                                                                                                              
    True
    >>> wkdkey(b"yetzt") == "5n734keb9dspf8neaanmsqsr9otxa8f9"
    True
    """
    return zb32_encode(hashlib.sha1(data.lower()).digest())

Details

Version
2.1.11

Event Timeline

werner added a subscriber: werner.

Frankly, I doubt that this belongs into gpgme.

werner claimed this task.