146 references to Sha1
Microsoft.CodeAnalysis (19)
CommandLine\CommandLineParser.cs (1)
1211return SourceHashAlgorithm.Sha1;
CryptographicHashProvider.cs (3)
69case SourceHashAlgorithm.Sha1: 84case SourceHashAlgorithm.Sha1: 100case SourceHashAlgorithm.Sha1:
EmbeddedText.cs (2)
136public static EmbeddedText FromStream(string filePath, Stream stream, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1) 175public static EmbeddedText FromBytes(string filePath, ArraySegment<byte> bytes, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1)
EncodedStringText.cs (2)
74SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 87SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1,
Syntax\SyntaxNode.cs (1)
326public SourceText GetText(Encoding? encoding = null, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1)
Text\SourceHashAlgorithms.cs (4)
31SourceHashAlgorithm.Sha1 => true, 39SourceHashAlgorithm.Sha1 => s_guidSha1, 46(guid == s_guidSha1) ? SourceHashAlgorithm.Sha1 : 54SourceHashAlgorithm.Sha1 => SHA1.Create(),
Text\SourceText.cs (5)
50protected SourceText(ImmutableArray<byte> checksum = default, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, SourceTextContainer? container = null) 105public static SourceText From(string text, Encoding? encoding = null, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1) 135SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1) 183SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 253SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1,
Text\StringText.cs (1)
27SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1,
Microsoft.CodeAnalysis.CodeStyle (2)
src\Compilers\Core\Portable\EncodedStringText.cs (2)
74SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 87SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1,
Microsoft.CodeAnalysis.CSharp (7)
Syntax\CSharpSyntaxTree.cs (4)
348checksumAlgorithm: SourceHashAlgorithm.Sha1, 402checksumAlgorithm: SourceHashAlgorithm.Sha1, 460return ParseText(SourceText.From(text, encoding, SourceHashAlgorithm.Sha1), options, path, diagnosticOptions, isGeneratedCode, cancellationToken); 928=> ParseText(SourceText.From(text, encoding, SourceHashAlgorithm.Sha1), options, path, diagnosticOptions, isGeneratedCode: null, cancellationToken);
Syntax\CSharpSyntaxTree.Dummy.cs (1)
19private const SourceHashAlgorithm ChecksumAlgorithm = SourceHashAlgorithm.Sha1;
Syntax\SyntaxFactory.cs (2)
1548=> CSharpSyntaxTree.Create((CSharpSyntaxNode)root, (CSharpParseOptions?)options ?? CSharpParseOptions.Default, path, encoding, SourceHashAlgorithm.Sha1); 1562return CSharpSyntaxTree.ParseText(SourceText.From(text, encoding, SourceHashAlgorithm.Sha1), (CSharpParseOptions?)options, path, diagnosticOptions: null, isGeneratedCode: null, cancellationToken);
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (2)
CommandLineTests.cs (2)
5822Assert.Equal(SourceHashAlgorithm.Sha1, parsedArgs.ChecksumAlgorithm); 14041context.AddSource("hint2", SourceText.From("class G2 { void F() {} }", Encoding.UTF8, checksumAlgorithm: SourceHashAlgorithm.Sha1));
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
PDB\CheckSumTest.cs (1)
34var tree1 = SyntaxFactory.ParseSyntaxTree(StringText.From(source1, Encoding.UTF8, SourceHashAlgorithm.Sha1), path: "sha1.cs");
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (6)
Syntax\SyntaxFactoryTests.cs (2)
47Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm); 55Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm);
Syntax\SyntaxTreeTests.cs (4)
122Assert.Equal(SourceHashAlgorithm.Sha1, tree.GetText().ChecksumAlgorithm); 134Assert.Equal(SourceHashAlgorithm.Sha1, tree.GetText().ChecksumAlgorithm); 253Assert.Equal(SourceHashAlgorithm.Sha1, newText.ChecksumAlgorithm); 295Assert.Equal(SourceHashAlgorithm.Sha1, newText.ChecksumAlgorithm);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CSharpTestBase.cs (1)
1081public static SyntaxTree Parse(string text, string filename = "", CSharpParseOptions options = null, Encoding encoding = null, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
EditAndContinue\EditAndContinueLanguageServiceTests.cs (1)
270Text = SourceText.From(source3, Encoding.UTF8, SourceHashAlgorithm.Sha1)
Microsoft.CodeAnalysis.Features.UnitTests (10)
EditAndContinue\EditAndContinueMethodDebugInfoReaderTests.cs (1)
63var tree = CSharpTestSource.Parse(source, path: "/a/c.cs", options: TestOptions.Regular.WithNoRefSafetyRulesAttribute(), checksumAlgorithm: SourceHashAlgorithm.Sha1);
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (9)
69var sourceTreeC1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesC1, sourceBytesC1.Length, encodingC, SourceHashAlgorithm.Sha1), TestOptions.Regular, sourceFileC.Path); 83.WithProjectChecksumAlgorithm(projectPId, SourceHashAlgorithm.Sha1); 114Assert.Equal(SourceHashAlgorithm.Sha1, solution.GetDocument(documentIdA).GetTextSynchronously(default).ChecksumAlgorithm); 115Assert.Equal(SourceHashAlgorithm.Sha1, solution.GetDocument(documentIdB).GetTextSynchronously(default).ChecksumAlgorithm); 116Assert.Equal(SourceHashAlgorithm.Sha1, solution.GetDocument(documentIdC).GetTextSynchronously(default).ChecksumAlgorithm); 117Assert.Equal(SourceHashAlgorithm.Sha1, solution.GetDocument(documentIdE).GetTextSynchronously(default).ChecksumAlgorithm); 622AddDocument("a.cs", SourceText.From(source1, Encoding.UTF8, SourceHashAlgorithm.Sha1), filePath: sourceFile.Path); 920WithProjectChecksumAlgorithm(projectId, SourceHashAlgorithm.Sha1). 922AddDocument(documentId, "test.cs", SourceText.From(source1, encoding, SourceHashAlgorithm.Sha1), filePath: sourceFile.Path);
Microsoft.CodeAnalysis.Rebuild (1)
CompilationOptionsReader.cs (1)
187hashAlgorithmGuid == HashAlgorithmSha1 ? SourceHashAlgorithm.Sha1
Microsoft.CodeAnalysis.Rebuild.UnitTests (3)
CSharpDeterministicKeyBuilderTests.cs (2)
77CSharpTestSource.Parse(@"System.Console.WriteLine(""Hello World"");", checksumAlgorithm: SourceHashAlgorithm.Sha1), 155checksumAlgorithm: SourceHashAlgorithm.Sha1);
DeterministicKeyBuilderTests.cs (1)
39SourceHashAlgorithm.Sha1,
Microsoft.CodeAnalysis.Test.Utilities (1)
Mocks\TestAdditionalText.cs (1)
22public TestAdditionalText(string text = "", Encoding? encoding = null, string path = "dummy", SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1)
Microsoft.CodeAnalysis.UnitTests (36)
EmbeddedTextTests.cs (24)
81var text = EmbeddedText.FromBytes("pathToEmpty", new ArraySegment<byte>(new byte[0], 0, 0), SourceHashAlgorithm.Sha1); 83Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm); 84AssertEx.Equal(SourceText.CalculateChecksum(new byte[0], 0, 0, SourceHashAlgorithm.Sha1), text.Checksum); 91var text = EmbeddedText.FromStream("pathToEmpty", new MemoryStream(new byte[0]), SourceHashAlgorithm.Sha1); 92var checksum = SourceText.CalculateChecksum(new byte[0], 0, 0, SourceHashAlgorithm.Sha1); 95Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm); 103var source = SourceText.From("", new UTF8Encoding(encoderShouldEmitUTF8Identifier: false), SourceHashAlgorithm.Sha1); 105var checksum = SourceText.CalculateChecksum(new byte[0], 0, 0, SourceHashAlgorithm.Sha1); 108Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm); 117var checksum = SourceText.CalculateChecksum(bytes, 0, bytes.Length, SourceHashAlgorithm.Sha1); 121Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm); 132var checksum = SourceText.CalculateChecksum(bytes, 0, bytes.Length, SourceHashAlgorithm.Sha1); 137Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm); 145var source = SourceText.From(SmallSource, Encoding.UTF8, SourceHashAlgorithm.Sha1); 149Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm); 200var expected = SourceText.From(SmallSource, Encoding.UTF8, SourceHashAlgorithm.Sha1); 203var actual = SourceText.From(new StringReader(SmallSource), SmallSource.Length, Encoding.UTF8, SourceHashAlgorithm.Sha1); 215var expected = SourceText.From(LargeSource, Encoding.UTF8, SourceHashAlgorithm.Sha1); 218var actual = SourceText.From(new StringReader(LargeSource), LargeSource.Length, Encoding.UTF8, SourceHashAlgorithm.Sha1); 236SourceText.From(new MemoryStream(bytes), Encoding.ASCII, SourceHashAlgorithm.Sha1, canBeEmbedded: true) : 237SourceText.From(bytes, bytes.Length, Encoding.ASCII, SourceHashAlgorithm.Sha1, canBeEmbedded: true); 241Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm); 242AssertEx.Equal(SourceText.CalculateChecksum(bytes, 0, bytes.Length, SourceHashAlgorithm.Sha1), source.GetChecksum()); 256Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm);
Text\LargeTextTests.cs (2)
33return LargeText.Decode(stream, encoding ?? Encoding.UTF8, SourceHashAlgorithm.Sha1, throwIfBinaryDetected: true, canBeEmbedded: false); 38return LargeText.Decode(reader, length, encoding ?? Encoding.UTF8, SourceHashAlgorithm.Sha1);
Text\SourceTextTests.cs (6)
85Assert.Equal(SourceHashAlgorithm.Sha1, SourceText.From(HelloWorld).ChecksumAlgorithm); 88Assert.Equal(SourceHashAlgorithm.Sha1, SourceText.From(bytes, bytes.Length).ChecksumAlgorithm); 91Assert.Equal(SourceHashAlgorithm.Sha1, SourceText.From(stream).ChecksumAlgorithm); 95[InlineData(SourceHashAlgorithm.Sha1)] 111var checksumAlgorithm = SourceHashAlgorithm.Sha1; 252var hashAlgorithms = new[] { SourceHashAlgorithm.Sha1, SourceHashAlgorithm.Sha256 };
Text\StringTextDecodingTests.cs (4)
19private static SourceText CreateMemoryStreamBasedEncodedText(string text, Encoding writeEncoding, Encoding readEncodingOpt, SourceHashAlgorithm algorithm = SourceHashAlgorithm.Sha1) 26private static SourceText CreateMemoryStreamBasedEncodedText(byte[] bytes, Encoding readEncodingOpt, SourceHashAlgorithm algorithm = SourceHashAlgorithm.Sha1) 42SourceHashAlgorithm algorithm = SourceHashAlgorithm.Sha1) 161EncodedStringText.TestAccessor.Decode(stream, utf8, SourceHashAlgorithm.Sha1, throwIfBinaryDetected: false, canBeEmbedded: false);
Microsoft.CodeAnalysis.VisualBasic (5)
Syntax\SyntaxNodeFactories.vb (2)
37Return VisualBasicSyntaxTree.Create(DirectCast(root, VisualBasicSyntaxNode), If(DirectCast(options, VisualBasicParseOptions), VisualBasicParseOptions.Default), path, encoding, SourceHashAlgorithm.Sha1) 50Return ParseSyntaxTree(SourceText.From(text, encoding, SourceHashAlgorithm.Sha1), options, path, cancellationToken)
Syntax\VisualBasicSyntaxTree.DummySyntaxTree.vb (1)
16Private Const ChecksumAlgorithm As SourceHashAlgorithm = SourceHashAlgorithm.Sha1
Syntax\VisualBasicSyntaxTree.vb (2)
172checksumAlgorithm:=SourceHashAlgorithm.Sha1, 220checksumAlgorithm:=SourceHashAlgorithm.Sha1,
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (1)
CommandLineTests.vb (1)
1909Assert.Equal(SourceHashAlgorithm.Sha1, parsedArgs.ChecksumAlgorithm)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (5)
Syntax\SyntaxFactoryTests.vb (2)
16Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm) 23Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm)
Syntax\SyntaxTreeTests.vb (3)
18Assert.Equal(SourceHashAlgorithm.Sha1, tree.GetText().ChecksumAlgorithm) 120Assert.Equal(SourceHashAlgorithm.Sha1, newText.ChecksumAlgorithm) 160Assert.Equal(SourceHashAlgorithm.Sha1, newText.ChecksumAlgorithm)
Microsoft.CodeAnalysis.Workspaces (7)
src\Compilers\Core\Portable\EncodedStringText.cs (2)
74SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 87SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1,
src\Compilers\Core\Portable\Text\SourceHashAlgorithms.cs (4)
31SourceHashAlgorithm.Sha1 => true, 39SourceHashAlgorithm.Sha1 => s_guidSha1, 46(guid == s_guidSha1) ? SourceHashAlgorithm.Sha1 : 54SourceHashAlgorithm.Sha1 => SHA1.Create(),
Workspace\Solution\ProjectInfo.cs (1)
239checksumAlgorithm: SourceHashAlgorithm.Sha1,
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (3)
VisualStudioMSBuildWorkspaceTests.cs (3)
281Assert.Equal(SourceHashAlgorithm.Sha1, project.State.ChecksumAlgorithm); 283Assert.All(project.Documents, d => Assert.Equal(SourceHashAlgorithm.Sha1, d.GetTextSynchronously(default).ChecksumAlgorithm)); 284Assert.All(project.AdditionalDocuments, d => Assert.Equal(SourceHashAlgorithm.Sha1, d.GetTextSynchronously(default).ChecksumAlgorithm));
Microsoft.CodeAnalysis.Workspaces.UnitTests (28)
SolutionTests\SolutionTests.cs (28)
305Assert.Equal(SourceHashAlgorithm.Sha1, tree.GetText().ChecksumAlgorithm); 350var text = SourceText.From("new text", encoding: null, SourceHashAlgorithm.Sha1); 451var text = SourceText.From("new text", encoding: null, SourceHashAlgorithm.Sha1); 539var text = SourceText.From("new text", encoding: null, SourceHashAlgorithm.Sha1); 622var text = SourceText.From("new text without pp directives", encoding: null, SourceHashAlgorithm.Sha1); 705var text = SourceText.From("#if true", encoding: null, SourceHashAlgorithm.Sha1); 781var text = SourceText.From("new text", encoding: null, SourceHashAlgorithm.Sha1); 868var text = SourceText.From(" ", encoding: null, SourceHashAlgorithm.Sha1); 1618var textLoaderA = new TestTextLoader("class A {}", SourceHashAlgorithm.Sha1); 1619var textC = SourceText.From("class C {}", encoding: null, checksumAlgorithm: SourceHashAlgorithm.Sha1); 1623.WithProjectChecksumAlgorithm(projectId, SourceHashAlgorithm.Sha1); 1630await Verify(solution.GetRequiredDocument(documentAId), SourceHashAlgorithm.Sha1); 1631await Verify(solution.GetRequiredDocument(documentBId), SourceHashAlgorithm.Sha1); 1632await Verify(solution.GetRequiredDocument(documentCId), SourceHashAlgorithm.Sha1); 1633await Verify(solution.GetRequiredDocument(fileDocumentId), SourceHashAlgorithm.Sha1, checksumSHA1); 1637await Verify(solution.GetRequiredDocument(documentAId), SourceHashAlgorithm.Sha1); 1638await Verify(solution.GetRequiredDocument(documentBId), SourceHashAlgorithm.Sha1); 1639await Verify(solution.GetRequiredDocument(documentCId), SourceHashAlgorithm.Sha1); 1643solution = solution.WithProjectChecksumAlgorithm(projectId, SourceHashAlgorithm.Sha1); 1644await Verify(solution.GetRequiredDocument(documentAId), SourceHashAlgorithm.Sha1); 1645await Verify(solution.GetRequiredDocument(documentBId), SourceHashAlgorithm.Sha1); 1646await Verify(solution.GetRequiredDocument(documentCId), SourceHashAlgorithm.Sha1); 1647await Verify(solution.GetRequiredDocument(fileDocumentId), SourceHashAlgorithm.Sha1, checksumSHA1); 2365var loader = new TestTextLoader(checksumAlgorithm: SourceHashAlgorithm.Sha1); 2373Assert.Equal(SourceHashAlgorithm.Sha1, document.GetTextSynchronously(default).ChecksumAlgorithm); 2483var root = CSharp.SyntaxFactory.ParseSyntaxTree(SourceText.From("class C {}", encoding: null, SourceHashAlgorithm.Sha1)).GetRoot(); 2484Assert.Equal(SourceHashAlgorithm.Sha1, root.SyntaxTree.GetText().ChecksumAlgorithm); 2513Assert.Equal(SourceHashAlgorithm.Sha1, root.SyntaxTree.GetText().ChecksumAlgorithm);
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
ProjectSystemShim\CPS\CSharpCompilerOptionsTests.cs (1)
188Assert.Equal(SourceHashAlgorithm.Sha1, environment.Workspace.CurrentSolution.Projects.Single().State.ChecksumAlgorithm);
Roslyn.VisualStudio.Next.UnitTests (6)
Services\ServiceHubServicesTests.cs (4)
496private static SourceText CreateText(string content, Encoding encoding = null, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1) 506return SourceText.From(stream, encoding, SourceHashAlgorithm.Sha1, throwIfBinaryDetected: true); 510return SourceText.From(bytes, bytes.Length, encoding, SourceHashAlgorithm.Sha1, throwIfBinaryDetected: true); 593ImmutableArray.Create(("SG.cs", CreateText("X", Encoding.UTF8, checksumAlgorithm: SourceHashAlgorithm.Sha1))),
Services\SolutionServiceTests.cs (2)
262.WithProjectChecksumAlgorithm(projectId, SourceHashAlgorithm.Sha1 + version) 278Assert.Equal(SourceHashAlgorithm.Sha1 + version, project.State.ChecksumAlgorithm);