Created
January 28, 2018 00:28
-
-
Save riverar/76f62919e26ba43ea64db6ffd668c710 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Rafael Rivera | |
// License: MIT | |
using System; | |
using System.Linq; | |
using System.Security.Cryptography; | |
using System.Text; | |
using MhanoHarkness; // NuGet: Base3264-UrlEncoder | |
namespace PublisherId_Sample | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
using (var sha = SHA256.Create()) | |
{ | |
var publisher = "CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"; | |
var hash = sha.ComputeHash(Encoding.Unicode.GetBytes(publisher)).Take(8).ToArray(); | |
Console.WriteLine($"Publisher\t: {publisher}"); | |
Console.WriteLine($"Publisher ID\t: {Base3264Encoding.ToBase32Crockford(hash).ToLower()}"); | |
Console.ReadKey(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment