Skip to content

Commit

Permalink
Revert "Fix Japanese delimiter bug (#110)"
Browse files Browse the repository at this point in the history
This reverts commit 71cf520.
  • Loading branch information
prusnak committed Aug 13, 2023
1 parent 3d6daa0 commit df3e150
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mnemonic/mnemonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def generate(self, strength: int = 128) -> str:
# Adapted from <http://tinyurl.com/oxmn476>
def to_entropy(self, words: Union[List[str], str]) -> bytearray:
if not isinstance(words, list):
words = words.split(self.delimiter)
words = words.split(" ")
if len(words) not in [12, 15, 18, 21, 24]:
raise ValueError(
"Number of words must be one of the following: [12, 15, 18, 21, 24], but it is not (%d)."
Expand Down Expand Up @@ -186,7 +186,7 @@ def to_mnemonic(self, data: bytes) -> str:
return self.delimiter.join(result)

def check(self, mnemonic: str) -> bool:
mnemonic_list = self.normalize_string(mnemonic).split(self.delimiter)
mnemonic_list = self.normalize_string(mnemonic).split(" ")
# list of valid mnemonic lengths
if len(mnemonic_list) not in [12, 15, 18, 21, 24]:
return False
Expand Down Expand Up @@ -217,7 +217,7 @@ def expand_word(self, prefix: str) -> str:
return prefix

def expand(self, mnemonic: str) -> str:
return " ".join(map(self.expand_word, mnemonic.split(self.delimiter)))
return " ".join(map(self.expand_word, mnemonic.split(" ")))

@classmethod
def to_seed(cls, mnemonic: str, passphrase: str = "") -> bytes:
Expand Down

0 comments on commit df3e150

Please sign in to comment.