incog_hex.py 845 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env python3
  2. #
  3. # mmgen = Multi-Mode GENerator, a command-line cryptocurrency wallet
  4. # Copyright (C)2013-2023 The MMGen Project <mmgen@tuta.io>
  5. # Licensed under the GNU General Public License, Version 3:
  6. # https://www.gnu.org/licenses
  7. # Public project repositories:
  8. # https://github.com/mmgen/mmgen-wallet
  9. # https://gitlab.com/mmgen/mmgen-wallet
  10. """
  11. wallet.incog_hex: hexadecimal incognito wallet class
  12. """
  13. from ..util2 import pretty_hexdump,decode_pretty_hexdump
  14. from .incog_base import wallet
  15. class wallet(wallet):
  16. desc = 'hex incognito data'
  17. file_mode = 'text'
  18. no_tty = False
  19. def _deformat(self):
  20. ret = decode_pretty_hexdump(self.fmt_data)
  21. if ret:
  22. self.fmt_data = ret
  23. return super()._deformat()
  24. else:
  25. return False
  26. def _format(self):
  27. super()._format()
  28. self.fmt_data = pretty_hexdump(self.fmt_data)