Skip to content

Commit

Permalink
fix: Fix collision between padding symbol and check symbol '='
Browse files Browse the repository at this point in the history
  • Loading branch information
0xsirsaif committed Dec 1, 2024
1 parent 220db08 commit e56dd91
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/idcrockford/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# =============================================================================

CROCKFORD_BASE32_ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"
CHECK_SYMBOLS = "*~$=U"
CHECK_SYMBOLS = "*~$U"

ENCODE_MAP = {i: char for i, char in enumerate(CROCKFORD_BASE32_ALPHABET)}
DECODE_MAP = {char: i for i, char in enumerate(CROCKFORD_BASE32_ALPHABET)}
Expand All @@ -26,9 +26,7 @@
}

# Regular expression for valid symbols
VALID_SYMBOLS_PATTERN: Pattern = re.compile(
f"^[{CROCKFORD_BASE32_ALPHABET}]+[{re.escape(CHECK_SYMBOLS)}]?=*$"
)
VALID_SYMBOLS_PATTERN: Pattern = re.compile(f"^[{CROCKFORD_BASE32_ALPHABET}]+[{re.escape(CHECK_SYMBOLS)}]?$")

# =============================================================================
# Utils
Expand Down

0 comments on commit e56dd91

Please sign in to comment.