Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestCase ID Generation algorithm to SHA1 on par with TPV1 #279

Merged
merged 2 commits into from
Dec 14, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/Microsoft.TestPlatform.ObjectModel/Utilities/EqtHash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

#if NET46
using System.Security.Cryptography;
#endif
using System.Security.Cryptography;

/// <summary>
/// Wrapper class for cryptographic hashing.
Expand All @@ -25,11 +23,13 @@ public static class EqtHash
public static Guid GuidFromString(string data)
{
Debug.Assert(data != null);
#if NET46
using (HashAlgorithm provider = new SHA256CryptoServiceProvider())
#else
using (var provider = System.Security.Cryptography.SHA256.Create())
#endif
// Do NOT change the algorithm ever as this will have compat implications
// TC-TA team has a feature in VS where workitems are associated based on TestCase Ids
// If Algorithm changes, then all the bugs/workitems filed in TFS Server against a given TestCase become unassociated if IDs change
// Any algorithm or logic change must require a sign off from feature owners of above
// Also, TPV2 and TPV1 must use same Algorithm until the time TPV1 is completely deleted to be on-par
// If LUT or .Net core scenario uses TPV2 to discover, but if it uses TPV1 in Devenv, then there will be testcase matching issues
using (HashAlgorithm provider = SHA1.Create())
{
byte[] hash = provider.ComputeHash(System.Text.Encoding.Unicode.GetBytes(data));

Expand Down