Mahamudra.Cryptography.Notation
1.0.1
This package has a SemVer 2.0.0 package version: 1.0.1+1.
dotnet add package Mahamudra.Cryptography.Notation --version 1.0.1
NuGet\Install-Package Mahamudra.Cryptography.Notation -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Mahamudra.Cryptography.Notation" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mahamudra.Cryptography.Notation" Version="1.0.1" />
<PackageReference Include="Mahamudra.Cryptography.Notation" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Mahamudra.Cryptography.Notation --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Mahamudra.Cryptography.Notation, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Mahamudra.Cryptography.Notation@1.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Mahamudra.Cryptography.Notation&version=1.0.1
#tool nuget:?package=Mahamudra.Cryptography.Notation&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Mahamudra Cryptography Notation
EncodeBase58
What is Base58 encoding?
Base58 is a binary-to-text encoding created by Satoshi Nakamoto for Bitcoin addresses. The original Bitcoin client source code explains the reasoning behind base58 encoding:
base58.h:
Why base-58 instead of standard base-64 encoding?
- Don't want 0OIl characters that look the same in some fonts and could be used to create visually identical looking account numbers.
- A string with non-alphanumeric characters is not as easily accepted as an account number.
- E-mail usually won't line-break if there's no punctuation to break at.
- Doubleclicking selects the whole number as one word if it's all alphanumeric.
A simple package that implements the base-58 encoding.
Usage
member this.EncodePlainv2 (bdata:byte[]):string =
let data = bdata |> Array.toList
let rec toBigInt = function
|[], acc -> acc
|h::t, acc -> toBigInt(t, acc*256I + bigint(int h))
let rec base58encode = function
| i,acc when i>0I ->
let reminder = ref 0I
let dividend = bigint.DivRem(i, 58I, reminder)
let char = ArryDigits.[(int)reminder.contents]
base58encode(dividend, char::acc)
| _,acc -> acc
let appendOnes =
let rec insertOnes = function
| h::t,acc when h=0uy -> insertOnes(t, '1'::acc)
| _,acc -> acc
insertOnes(data, [])
let big = toBigInt(data, 0I)
let encoded = appendOnes @ base58encode(big, []) |> List.toArray
encoded |> System.String
[<TestMethod>]
member this.EncodePlain_ShouldGiveString1_True () =
let value = [|0x00uy; 0x00uy; 0x00uy; 0x01uy |]
let string1 = "1112";
let base58 = new Base58()
let encoding = base58.EncodePlain(value);
let encodingv2 = base58.EncodePlainv2(value);
Assert.AreEqual(encoding, string1)
Assert.AreEqual(encodingv2, string1)
Flaticon License
Free for personal and commercial purpose with attribution.
<a href="https://www.flaticon.com/free-icons/lotus-flower" title="lotus flower icons">Lotus flower icons created by Freepik - Flaticon</a>
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- FSharp.Core (>= 6.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.