Пример #1
0
 private void GenerateDefaultHashes(byte[] assemblyBytes)
 {
     Type[] typeArray = new Type[3] {
         Hash.GetHashIndexType(typeof(System.Security.Cryptography.SHA1)), Hash.GetHashIndexType(typeof(System.Security.Cryptography.SHA256)), Hash.GetHashIndexType(typeof(System.Security.Cryptography.MD5))
     };
     foreach (Type index in typeArray)
     {
         Type hashImplementation = Hash.GetDefaultHashImplementation(index);
         if (hashImplementation != (Type)null && !this.m_hashes.ContainsKey(index))
         {
             this.m_hashes[index] = Hash.GenerateHash(hashImplementation, assemblyBytes);
         }
     }
 }
Пример #2
0
        // Token: 0x06002ABC RID: 10940 RVA: 0x0009E9D0 File Offset: 0x0009CBD0
        private byte[] GenerateHash(Type hashType)
        {
            Type hashIndexType = Hash.GetHashIndexType(hashType);

            byte[] array = null;
            if (!this.m_hashes.TryGetValue(hashIndexType, out array))
            {
                if (this.m_assembly == null)
                {
                    throw new InvalidOperationException(Environment.GetResourceString("Security_CannotGenerateHash"));
                }
                array = Hash.GenerateHash(hashType, this.GetRawData());
                this.m_hashes[hashIndexType] = array;
            }
            return(array);
        }
Пример #3
0
 // Token: 0x06002ABF RID: 10943 RVA: 0x0009EA8C File Offset: 0x0009CC8C
 private void GenerateDefaultHashes(byte[] assemblyBytes)
 {
     Type[] array = new Type[]
     {
         Hash.GetHashIndexType(typeof(SHA1)),
         Hash.GetHashIndexType(typeof(SHA256)),
         Hash.GetHashIndexType(typeof(MD5))
     };
     foreach (Type type in array)
     {
         Type defaultHashImplementation = Hash.GetDefaultHashImplementation(type);
         if (defaultHashImplementation != null && !this.m_hashes.ContainsKey(type))
         {
             this.m_hashes[type] = Hash.GenerateHash(defaultHashImplementation, assemblyBytes);
         }
     }
 }