refactored ZNKey+BIP38 to remove some code duplication