Extracted from https://github.com/pacemkr/secrets