UrlBase64 2.0.0-preview1
See the version list below for details.
dotnet add package UrlBase64 --version 2.0.0-preview1
NuGet\Install-Package UrlBase64 -Version 2.0.0-preview1
<PackageReference Include="UrlBase64" Version="2.0.0-preview1" />
paket add UrlBase64 --version 2.0.0-preview1
#r "nuget: UrlBase64, 2.0.0-preview1"
// Install UrlBase64 as a Cake Addin #addin nuget:?package=UrlBase64&version=2.0.0-preview1&prerelease // Install UrlBase64 as a Cake Tool #tool nuget:?package=UrlBase64&version=2.0.0-preview1&prerelease
UrlBase64
UrlBase64
is a package for all versions of the .NET Framework and .NET Core, which supports the creation of url-safe base64 encoding. UrlBase64
provides symmetric routines to both encode and later decode data in a fashion that makes it safe for use on the general web and as input to ASP.NET web applications (under IIS or similar).
Installation
UrlBase64
is available via nuget and the Visual Studio package manager. To install, simply run the following in the package manager console:
Install-Package UrlBase64
Or search for UrlBase64
in the Visual Studio package manager.
Usage
All functions are contained in the static UrlBase64
class, found in the NeoSmart.Utils
namespace.
using NeoSmart.Utils;
void UsageSample()
{
var foo = Encoding.UTF8.GetBytes("foo");
var encoded = UrlBase64.Encode(foo);
var decoded = UrlBase64.Decode(encoded);
var bar = Encoding.UTF8.GetString(decoded);
Assert.AreEqual("foo", bar);
}
Padding Options (Encoding)
UrlBase64
supports two different padding modes (internally: PaddingPolicy
) for generating base64 content:
public enum PaddingPolicy
{
Discard,
Preserve,
}
The PaddingPolicy
option controls the behavior of UrlBase64
when encoding content that does not fall on a 4-character (output) boundary. Per RFC 4648, base64 specifies that an "optional depending on the circumstances" trailing =
sign is used to pad the output to be a multiple of 4 characters long. UrlBase64
supports both padded and unpadded output via an optional PaddingPolicy
parameter to UrlBase64.Encode
controlling this behavior. The default behavior at this time is to omit the trailing padding given that it a) can (and usually is) be inferred automatically when dropped from the encoded output, and b) utilizes a symbol that requires encoding when used in URLs.
var bytes = Encoding.UTF8.GetBytes("Mary had a little lamb");
Console.WriteLine(bytes, UrlBase64.Encode(bytes, PaddingPolicy.Discard));
Console.WriteLine(bytes, UrlBase64.Encode(bytes, PaddingPolicy.Preserve));
TWFyeSBoYWQgYSBsaXR0bGUgbGFtYg TWFyeSBoYWQgYSBsaXR0bGUgbGFtYg==
License and Copyright
UrlBase64
is developed by Mahmoud Al-Qudsi of NeoSmart Technologies. UrlBase64
is released under the terms of the MIT Public License. Copyright NeoSmart Technologies 2017-2018.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.0 is compatible. netstandard1.1 was computed. netstandard1.2 was computed. netstandard1.3 was computed. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net20 is compatible. net35 was computed. net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Windows Phone | wp8 was computed. wp81 was computed. wpa81 was computed. |
Windows Store | netcore was computed. netcore45 was computed. netcore451 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 2.0
- No dependencies.
-
.NETFramework 4.0
- No dependencies.
-
.NETStandard 1.0
- NETStandard.Library (>= 1.6.1)
-
.NETStandard 2.0
- System.Buffers (>= 4.5.0)
- System.Memory (>= 4.5.3)
NuGet packages (9)
Showing the top 5 NuGet packages that depend on UrlBase64:
Package | Downloads |
---|---|
H.Necessaire.Runtime
A Core Framework for Rapid Application Development |
|
Enmeshed.Tooling
Package Description |
|
SingBoxLib
Configure and run sing-box with ease. Based on sing-box's official documentation. |
|
GeometryDashAPI
API for game Geometry Dash |
|
UwpCache
A persistent object cache for your Windows 10 uwp and uap applications. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
2.0.0 | 75,648 | 5/16/2024 | |
2.0.0-preview2 | 112 | 4/18/2024 | |
2.0.0-preview1 | 1,474 | 10/28/2023 | |
1.0.1 | 147,724 | 9/27/2023 | |
1.0.0 | 10,881 | 9/5/2023 | |
0.1.2 | 1,177,567 | 2/2/2018 | |
0.1.1 | 5,665 | 9/21/2017 | |
0.1.0 | 3,208 | 7/13/2017 |
2.0.0:
* Add support for allocation-free encode/decode
* Add new binary/UTF-8 Decode() method to decode url-safe base64-encoded bytes directly,
without going through a string representation.
1.0.0:
* Support for Span<T> and co.
0.1.2:
* New PaddingPolicy option to specify output padding
* Lower .NET Standard requirement to 1.0
0.1.1:
* Fixed an encoded error with inputs of a certain length.
0.1:
* Initial release