Remix.run Logo
Ezhik 2 days ago

(developer here)

I specifically tried to make this mostly Obsidian-agnostic - the algorithm to generate these note codes is very simple and only requires the note's path relative to the vault.

Here's the whole algorithm in Python:

    import hashlib
    
    def hash_string(s):
        h = hashlib.sha256(s.encode()).digest()
        n = ((h[0] << 16) | (h[1] << 8) | h[2]) % (32**4)
        a = '0123456789ABCDEFGHJKMNPQRSTVWXYZ'
        r = ''.join(a[n // 32**(3-i) % 32] for i in range(4))
        return f"{r[:2]}-{r[2:]}"