From d289d9ae19ccecc1c7c41d965aed372ea1f358da Mon Sep 17 00:00:00 2001 From: Sai Krishna Vajjala Date: Wed, 14 Dec 2016 14:23:26 +0530 Subject: [PATCH 1/2] Change algorithm to SHA1 to be in compat with Associate-WorkItem scenarios Also TPV1 and TPV2 should use same algorithm since Devenv uses TPV1 even if LUT Or .NetCore use TPV2 --- src/Microsoft.TestPlatform.ObjectModel/Utilities/EqtHash.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.TestPlatform.ObjectModel/Utilities/EqtHash.cs b/src/Microsoft.TestPlatform.ObjectModel/Utilities/EqtHash.cs index 8005f1626a..b99a3ae2b6 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Utilities/EqtHash.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Utilities/EqtHash.cs @@ -26,7 +26,7 @@ public static Guid GuidFromString(string data) { Debug.Assert(data != null); #if NET46 - using (HashAlgorithm provider = new SHA256CryptoServiceProvider()) + using (HashAlgorithm provider = SHA1.Create()) #else using (var provider = System.Security.Cryptography.SHA256.Create()) #endif From 3a2a32fb8a821d153fc9810136a3815acde3b97e Mon Sep 17 00:00:00 2001 From: Sai Krishna Vajjala Date: Wed, 14 Dec 2016 14:30:27 +0530 Subject: [PATCH 2/2] Comment and Change .NetCore algo as well --- .../Utilities/EqtHash.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Microsoft.TestPlatform.ObjectModel/Utilities/EqtHash.cs b/src/Microsoft.TestPlatform.ObjectModel/Utilities/EqtHash.cs index b99a3ae2b6..641d3c6edc 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Utilities/EqtHash.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Utilities/EqtHash.cs @@ -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; /// /// Wrapper class for cryptographic hashing. @@ -25,11 +23,13 @@ public static class EqtHash public static Guid GuidFromString(string data) { Debug.Assert(data != null); -#if NET46 + // 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()) -#else - using (var provider = System.Security.Cryptography.SHA256.Create()) -#endif { byte[] hash = provider.ComputeHash(System.Text.Encoding.Unicode.GetBytes(data));