-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hash the generator assembly and type names
Since the names of the generator/type may reveal sensitive things (company names), we'll hash this; this is sharing the same code we use for analyzers.
- Loading branch information
1 parent
a5aec76
commit edefbd1
Showing
3 changed files
with
24 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/Workspaces/Core/Portable/Log/AnalyzerNameForTelemetry.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Security.Cryptography; | ||
using System.Text; | ||
|
||
namespace Microsoft.CodeAnalysis.Internal.Log | ||
{ | ||
internal static class AnalyzerNameForTelemetry | ||
{ | ||
public static string ComputeSha256Hash(string name) | ||
{ | ||
using var sha256 = SHA256.Create(); | ||
return Convert.ToBase64String(sha256.ComputeHash(Encoding.UTF8.GetBytes(name))); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters