Skip to content
This repository was archived by the owner on Oct 28, 2025. It is now read-only.
This repository was archived by the owner on Oct 28, 2025. It is now read-only.

Custom alphabet option #63

Description

@dfahlander

This might be an addon proposal as this proposal has already reached implementations.

When it comes to comparision and sorting, base64 does not preserve the sort order from the original array. This is possible to achieve by using another alphabet that preserves the lexical order of the orignal array as long as arrays are of the same lengths.

Could it be an option to provide a custom alphabet else than base64 and base64url? If the alphabet option would be something like {custom: string} it might allow for using a custom alphabet?

Implementations examples and related articles:

Activity

  1. bakkot commented on Feb 4, 2025

    @bakkot
    Member

    It would have to be a followup proposal, but yes, it could be done - the two values for the alphabet option are much shorter than any valid alphabet, so a straightforward extension would be to also allow a length-64 string to use as the alphabet. There would need to be a strong motivation, however, and I don't think the sorting use case comes up often enough to be a motivation on its own.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions