Okay I did it: http://git.zx2c4.com/password-store/commit/?id=a408bb5bd663694578579c170e5064861f1b72ca PLEASE TEST THIS FROM ALL EDGE CASES AND OBSCURE ANGLES. TRY TO BREAK IT. IT IS MOST LIKELY BROKEN. Really. Please test. Let me know what works and what doesn't. Submit patches to make it more robust. Etc etc.