It’s definitely a fairly trivial implementation, here’s one of a few dozen lines of (not very clean) Swift: https://github.com/JustAman62/ovault/blob/7ee38b7e5c2666cd34...
The simplicity of the implementation makes a test suite even more valuable, as it’s really quite hard to figure out if your implementation is correct.