Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Geração de HASH do SKU pra enviar para Vtex
//Rextester.Program.Main is the entry point for your code. Don't change it. //Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354) using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { Console.WriteLine(Guid.NewGuid().GenerateHash()); } } public static class GuidExtensions { public static string GenerateHash(this Guid guid) { var str = guid.ToString(); unchecked { int hash1 = (5381 << 16) + 5381; int hash2 = hash1; for (int i = 0; i < str.Length; i += 2) { hash1 = ((hash1 << 5) + hash1) ^ str[i]; if (i == str.Length - 1) break; hash2 = ((hash2 << 5) + hash2) ^ str[i + 1]; } int intHash = hash1 + (hash2 * 1566083941); string returnHash = intHash < 0 ? $"N{intHash * -1}" : $"P{intHash}"; returnHash += DateTime.Now.ToString("MMddyyyyhhmmssfff"); return returnHash; } } } }
run
|
edit
|
history
|
help
0
codejam1a1
Test
free robux
ew
PERSHENDETJE
extrefGenerate
bc160401882
6
sdfgjikjuyhtgrfed
abc