Skip to content

fix: implement Base58 encoding and decoding in ciphers/base58.py - #15815

Open
Mugunth007 wants to merge 1 commit into
TheAlgorithms:masterfrom
Mugunth007:fix/base58-implementation
Open

Mugunth007 wants to merge 1 commit into
TheAlgorithms:masterfrom
Mugunth007:fix/base58-implementation

Conversation

@Mugunth007

Copy link
Copy Markdown

Fixes #15637

Describe your change:

Fixes ciphers/base58.py, which previously contained an identical copy of base64_cipher.py. This PR implements canonical Base58 encoding and decoding using the Bitcoin alphabet (123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz).

  • Implements base58_encode() handling arbitrary bytes and encoding leading zero bytes as '1's.
  • Implements base58_decode() reconstructing original bytes.
  • Includes type annotations and 13 passing doctests covering standard Bitcoin test vectors, empty bytes, leading zeros, and error validation.

Checklist:

@algorithms-keeper algorithms-keeper Bot added awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files tests are failing Do not merge until tests pass labels Nov 27, 2026
@Mugunth007
Mugunth007 force-pushed the fix/base58-implementation branch from 60a4f32 to 4140d57 Compare November 27, 2026 01:46
@algorithms-keeper algorithms-keeper Bot removed the tests are failing Do not merge until tests pass label Nov 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ciphers/base58.py is a copy of base64_cipher.py — no Base58 implementation exists in the file

1 participant