Example #1
0
 static string CalculatePublicKeyToken(BlobHandle blob, MetadataReader reader)
 {
     // Calculate public key token:
     // 1. hash the public key using the appropriate algorithm.
     byte[] publicKeyTokenBytes = reader.GetHashAlgorithm().ComputeHash(reader.GetBlobBytes(blob));
     // 2. take the last 8 bytes
     // 3. according to Cecil we need to reverse them, other sources did not mention this.
     return(publicKeyTokenBytes.TakeLast(8).Reverse().ToHexString(8));
 }