Runtime: Support for Base32 encoding

Created on 20 Nov 2017  路  8Comments  路  Source: dotnet/runtime

Currently there is no official support in .NET for Base32 encoding, unlike Base64 encoding.
There is also no nuget package with this functionality that's widely used:
https://www.nuget.org/packages?q=base32

Have you considered adding this to .NET? What's the recommendation for developers that need this?

api-suggestion area-System.Runtime

Most helpful comment

Interestingly, it appears that even asp.net core uses this ( Base32.cs ) in more than one place, but it's marked as internal. Maybe it's used more than originally given credit.

Did any nuget package come out of this?

All 8 comments

What are examples where Base32 encoding is used? How common is it compared to Base64?
Which alternative of Base32 is the one most used?

I wonder if the lack of existing NuGet package is sign of lower need for the capability ...
If the encoding is not super-popular, it may be still a better choice to put it into separate NuGet package.

In our scenario (nuget.org) we will use Base32 to encode ApiKeys - tokens that are used for CLI authentication. In general, from what I saw Base32 is useful when you need to create an encoded string that has a single case (unlike Base64 string). I know VSTS uses it as well to encode tokens, but have no definitive information about additional usages.
Regarding which alternative - we are using the basic Base32 as defined in the RFC: https://tools.ietf.org/html/rfc4648

An option we are considering is to publish an official NuGet package by the NuGet team that will provide this functionality, and perhaps be more widely adopted by the community. Is this the recommendation in cases like this?

Yes, separate nuget package created by those who need it is the best option IMO.

In general, we want to grow BCL/CoreFX with APIs, which are widely used and either extend existing classes, or are used by BCL/CoreFX itself.
There is infinite number of additional classes we could add and customers would want, but we consider them out of scope of CoreFX: see examples in dotnet/runtime#22228.

Sounds good!
Is there a specific nuget package id format you recommend for those kinds of packages? For example: Microsoft.CoreFx.Extensions.* (and a Base32 support package will be named Microsoft.CoreFx.Extensions.Base32)?

@terrajobst @danmosemsft any package name preference?
I think I have seen Microsoft.Extensions.* pattern used by ASP.NET

@terrajobst should answer that.

I guess as @karelz says base32 is much less used: our base64 encoding/decoding is heavily optimized as it is used by networking, crypto, and XML. If we needed it for any such things, we would very likely expose the function publicly, but apparnetly we do not.

Closing per discussion above.

Interestingly, it appears that even asp.net core uses this ( Base32.cs ) in more than one place, but it's marked as internal. Maybe it's used more than originally given credit.

Did any nuget package come out of this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bencz picture bencz  路  3Comments

iCodeWebApps picture iCodeWebApps  路  3Comments

yahorsi picture yahorsi  路  3Comments

EgorBo picture EgorBo  路  3Comments

v0l picture v0l  路  3Comments