All Projects → neosmart → UrlBase64

neosmart / UrlBase64

Licence: MIT License
A standards-compliant implementation of web/url-safe base64 encoding and decoding for .NET targets

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to UrlBase64

Framework
.NET Core Extensions and Helper NuGet packages.
Stars: ✭ 399 (+1496%)
Mutual labels:  nuget, asp-net-core, asp-net
PersianDataAnnotations
PersianDataAnnotations is ASP.NET Core MVC & ASP.NET MVC Custom Localization DataAnnotations (Localized MVC Errors) for Persian(Farsi) language - فارسی سازی خطاهای اعتبارسنجی توکار ام.وی.سی. و کور.ام.وی.سی. برای نمایش اعتبار سنجی سمت کلاینت
Stars: ✭ 38 (+52%)
Mutual labels:  nuget, asp-net-core, asp-net
X.Web.Sitemap
Simple sitemap generator for .NET
Stars: ✭ 66 (+164%)
Mutual labels:  nuget, asp-net-core, asp-net
Templates
.NET project templates with batteries included, providing the minimum amount of code required to get you going faster.
Stars: ✭ 2,864 (+11356%)
Mutual labels:  nuget, asp-net-core, asp-net
adminlte-aspnetcore2-version
Asp.Net Example version of famous and beautiful AdminLTE control panel themes and template.
Stars: ✭ 64 (+156%)
Mutual labels:  asp-net-core, asp-net
squidex-samples
Samples for Squidex
Stars: ✭ 47 (+88%)
Mutual labels:  asp-net-core, asp-net
GPONMonitor
GPON Monitoring tool for Dasan Networks GPON OLTs
Stars: ✭ 26 (+4%)
Mutual labels:  asp-net-core, asp-net
NClient
💫 NClient is an automatic type-safe .Net HTTP client that allows you to call web service API methods using annotated interfaces or controllers without boilerplate code.
Stars: ✭ 25 (+0%)
Mutual labels:  asp-net-core, asp-net
squidex-identity
Identity Server for Squidex Headless CMS
Stars: ✭ 28 (+12%)
Mutual labels:  asp-net-core, asp-net
I18N
I18N Library for .NET, and Delphi
Stars: ✭ 48 (+92%)
Mutual labels:  asp-net-core, asp-net
SQRL-For-Dot-Net-Standard
SQRL for the .Net Standard runtimes. Secure Quick Reliable Login is a highly secure user privacy based authentication system that removes the need for users to have more than one password for a global identity https://www.grc.com/sqrl/sqrl.htm for more information of the protocal.
Stars: ✭ 26 (+4%)
Mutual labels:  asp-net-core, asp-net
vctr
vctr is a self hosted short link management tool.
Stars: ✭ 14 (-44%)
Mutual labels:  asp-net-core, asp-net
Cake-Shop
A sample Cake Shop Website built with ASP.NET Core (Multi-Page Application)
Stars: ✭ 44 (+76%)
Mutual labels:  asp-net-core, asp-net
Awesome-Nuget-Packages
📦 A collection of awesome and top .NET packages sorted by most popular needs.
Stars: ✭ 87 (+248%)
Mutual labels:  asp-net-core, asp-net
csharp
📚 Recursos para aprender C#
Stars: ✭ 37 (+48%)
Mutual labels:  asp-net-core, asp-net
DNZ.SEOChecker
SEO Checker and Recommander Plugin (like wordpress Yoast) for ASP.NET Core.
Stars: ✭ 18 (-28%)
Mutual labels:  asp-net-core, asp-net
SimpleSocial
A simple social network web application using ASP.NET Core 3.1
Stars: ✭ 16 (-36%)
Mutual labels:  asp-net-core, asp-net
StormReport
🌀 Library - Create your reports using only annotations
Stars: ✭ 17 (-32%)
Mutual labels:  asp-net-core, asp-net
Home
Home for Blazor Extensions
Stars: ✭ 51 (+104%)
Mutual labels:  asp-net-core, asp-net
AspNetCore-Dynamic-Permission
Dynamic Permission Samples in ASP.NET Core and ASP.NET MVC 5.
Stars: ✭ 19 (-24%)
Mutual labels:  asp-net-core, asp-net

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].