SteamKit2.CryptoHelper.SHAHash C# (CSharp) Method

SHAHash() public static method

Performs an SHA1 hash of an input byte array
public static SHAHash ( byte input ) : byte[]
input byte
return byte[]
        public static byte[] SHAHash( byte[] input )
        {
            using ( var sha = new SHA1Managed() )
            {
                return sha.ComputeHash( input );
            }
        }

Usage Example

Ejemplo n.º 1
0
        public static byte[] GenerateMachineID()
        {
            // this is steamkit's own implementation, it doesn't match what steamclient does
            // but this should make it so individual systems can be identified

            PlatformID platform = Environment.OSVersion.Platform;

            if (platform == PlatformID.Win32NT)
            {
                string hwString = "foobar";

                try
                {
                    RegistryKey localKey = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64);
                    localKey = localKey.OpenSubKey(@"SOFTWARE\Microsoft\Cryptography");
                    if (localKey != null)
                    {
                        hwString = localKey.GetValue("MachineGuid").ToString();
                    }
                }
                catch { }

                try
                {
                    return(CryptoHelper.SHAHash(Encoding.ASCII.GetBytes(hwString.ToString())));
                }
                catch { return(null); }
            }
            else
            {
                // todo: implement me!
                return(null);
            }
        }
All Usage Examples Of SteamKit2.CryptoHelper::SHAHash