1
0

commands: fix encrypt/decrypt

based on Electron-Cash/Electron-Cash@62aa08a0ff
This commit is contained in:
SomberNight
2019-05-03 03:10:31 +02:00
parent 387834164c
commit fd5b1acdc8
7 changed files with 44 additions and 18 deletions

View File

@@ -23,7 +23,7 @@
import binascii
import os, sys, re, json
from collections import defaultdict, OrderedDict
from typing import NamedTuple, Union, TYPE_CHECKING, Tuple, Optional, Callable
from typing import NamedTuple, Union, TYPE_CHECKING, Tuple, Optional, Callable, Any
from datetime import datetime
import decimal
from decimal import Decimal
@@ -493,9 +493,14 @@ def is_valid_email(s):
return re.match(regexp, s) is not None
def is_hash256_str(text: str) -> bool:
def is_hash256_str(text: Any) -> bool:
if not isinstance(text, str): return False
if len(text) != 64: return False
return is_hex_str(text)
def is_hex_str(text: Any) -> bool:
if not isinstance(text, str): return False
try:
bytes.fromhex(text)
except: