Minikey: minimum length 20
On second thoughts there seems little reason to accept text of length <= 20 for minikeys.
This commit is contained in:
parent
ec929bfaf6
commit
b878c010da
|
@ -382,11 +382,12 @@ def is_private_key(key):
|
||||||
|
|
||||||
def is_minikey(text):
|
def is_minikey(text):
|
||||||
# Minikeys are typically 22 or 30 characters, but this routine
|
# Minikeys are typically 22 or 30 characters, but this routine
|
||||||
# permits any length provided the minikey is valid. A valid
|
# permits any length of 20 or more provided the minikey is valid.
|
||||||
# minikey must begin with an 'S', be in base58, and when suffixed
|
# A valid minikey must begin with an 'S', be in base58, and when
|
||||||
# with '?' have its SHA256 hash begin with a zero byte. They are
|
# suffixed with '?' have its SHA256 hash begin with a zero byte.
|
||||||
# widely used in Casascius physical bitoins.
|
# They are widely used in Casascius physical bitoins.
|
||||||
return (text and text[0] == 'S' and all(c in __b58chars for c in text)
|
return (len(text) >= 20 and text[0] == 'S'
|
||||||
|
and all(c in __b58chars for c in text)
|
||||||
and ord(sha256(text + '?')[0]) == 0)
|
and ord(sha256(text + '?')[0]) == 0)
|
||||||
|
|
||||||
def minikey_to_private_key(text):
|
def minikey_to_private_key(text):
|
||||||
|
|
Loading…
Reference in New Issue