예제 #1
0
        static void Main(string[] args)
        {
            var sha256 = new System.Security.Cryptography.SHA256Managed();

            Console.WriteLine(HashBuilder.Build("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"));
            Console.ReadKey();
        }
예제 #2
0
        public XamlFileDefinition(string file)
        {
            Namespaces = new List <NamespaceDeclaration>();
            Objects    = new List <XamlObjectDefinition>();
            FilePath   = file;

            UniqueID = SanitizedFileName + "_" + HashBuilder.Build(FilePath);
        }
예제 #3
0
 public Dictionary <string, string> GetTelemetryCommonProperties() => new Dictionary <string, string>
 {
     { OSVersion, RuntimeEnvironment.OperatingSystemVersion },
     { OSPlatform, RuntimeEnvironment.OperatingSystemPlatform.ToString() },
     { OutputRedirected, Console.IsOutputRedirected.ToString() },
     { RuntimeId, RuntimeEnvironment.GetRuntimeIdentifier() },
     { ProductVersion, GetProductVersion() },
     { TelemetryProfile, Environment.GetEnvironmentVariable(TelemetryProfileEnvironmentVariable) },
     { MachineId, GetMachineId() },
     { CurrentPathHash, HashBuilder.Build(_getCurrentDirectory(), SHA256.Create()) },
     { KernelVersion, GetKernelVersion() },
 };
예제 #4
0
        private string GetMachineId()
        {
            try
            {
                var macAddr =
                    (
                        from nic in NetworkInterface.GetAllNetworkInterfaces()
                        where nic.OperationalStatus == OperationalStatus.Up
                        select nic.GetPhysicalAddress().ToString()
                    ).FirstOrDefault();

                return(HashBuilder.Build(macAddr, SHA256.Create()));
            }
            catch (Exception e)
            {
                Debug.Fail($"Failed to get Mac address: {e}");

                return(Guid.NewGuid().ToString());
            }
        }
예제 #5
0
        }                                        // レコード

        // SHA256でハッシュ化
        public new string GetHashCode()
        {
            return(HashBuilder.Build(id));
        }