Skip to content

[WIP] Add base64 module for binary-to-text encoding - #783

Closed
antonsynd with Copilot wants to merge 1 commit into
mainlinefrom
copilot/feat-stdlib-add-base64
Closed

antonsynd with Copilot wants to merge 1 commit into
mainlinefrom
copilot/feat-stdlib-add-base64

Conversation

Copilot AI commented May 29, 2026

Copy link
Copy Markdown
Contributor

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>feat(stdlib): add base64 module — base16/32/64/85 encoding</issue_title>
<issue_description>## Summary
Add a base64 module wrapping System.Convert and System.Buffers.Text for binary-to-text encoding, matching Python's base64 module API.

.NET Backing

System.Convert.ToBase64String/FromBase64String, System.Buffers.Text.Base64 for high-perf paths.

Proposed Sharpy API

import base64

encoded: bytes = base64.b64encode(data)           # Standard base64
decoded: bytes = base64.b64decode(encoded)
encoded: bytes = base64.urlsafe_b64encode(data)   # URL-safe variant
encoded: bytes = base64.b32encode(data)            # Base32
encoded: bytes = base64.b16encode(data)            # Base16 (hex)
encoded: bytes = base64.b85encode(data)            # Base85 (Ascii85)
encoded: bytes = base64.a85encode(data)            # Ascii85

Key Decisions

  • All functions work with bytes objects (matching Python)
  • Standard base64 uses System.Convert; URL-safe variant replaces +/ with -_
  • b32/b16 are straightforward; b85/a85 need custom implementation (no .NET built-in)
  • Support altchars parameter for b64encode/b64decode

Test Plan

  • b64encode/b64decode roundtrip
  • urlsafe_b64encode/decode
  • b32encode/b32decode
  • b16encode/b16decode
  • b85encode/b85decode, a85encode/a85decode
  • Padding handling
  • Error handling for invalid input
  • Empty input edge case
    </issue_description>

Comments on the Issue (you are @copilot in this section)

@antonsynd

Copy link
Copy Markdown
Owner

Closing empty WIP PR — duplicate of #772 which has the actual implementation.

@antonsynd antonsynd closed this May 29, 2026
@antonsynd
antonsynd deleted the copilot/feat-stdlib-add-base64 branch May 29, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(stdlib): add base64 module — base16/32/64/85 encoding

2 participants