327 references to SourceHashAlgorithm
GenerateDocumentationAndConfigFiles (9)
src\roslyn\src\Compilers\Core\Portable\EncodedStringText.cs (8)
73/// from <see cref="SourceText.From(Stream, Encoding, SourceHashAlgorithm, bool)"/> in two ways: 93SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 106SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 149SourceHashAlgorithm checksumAlgorithm, 249internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded) 252internal static SourceText Decode(Stream data, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected, bool canBeEmbedded)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\AdditionalTextExtensions.cs (1)
15private static readonly SourceText s_emptySourceText = SourceText.From("", s_utf8bom, SourceHashAlgorithm.Sha256);
Microsoft.CodeAnalysis (122)
CommandLine\CommandLineArguments.cs (1)
254public SourceHashAlgorithm ChecksumAlgorithm { get; internal set; }
CommandLine\CommonCompiler.cs (1)
866private protected abstract GeneratorDriver CreateGeneratorDriver(string baseDirectory, ParseOptions parseOptions, ImmutableArray<ISourceGenerator> generators, AnalyzerConfigOptionsProvider analyzerConfigOptionsProvider, ImmutableArray<AdditionalText> additionalTexts, SourceHashAlgorithm checksumAlgorithm);
Compilation\DeterministicKeyBuilder.cs (1)
354var checksumAlgorithm = SourceHashAlgorithms.Default;
CryptographicHashProvider.cs (18)
65internal static int GetHashSize(SourceHashAlgorithm algorithmId) 69case SourceHashAlgorithm.Sha1: 72case SourceHashAlgorithm.Sha256: 75case SourceHashAlgorithm.Sha384: 78case SourceHashAlgorithm.Sha512: 86internal static HashAlgorithm? TryGetAlgorithm(SourceHashAlgorithm algorithmId) 90case SourceHashAlgorithm.Sha1: 94case SourceHashAlgorithm.Sha256: 97case SourceHashAlgorithm.Sha384: 100case SourceHashAlgorithm.Sha512: 108internal static HashAlgorithmName GetAlgorithmName(SourceHashAlgorithm algorithmId) 112case SourceHashAlgorithm.Sha1: 116case SourceHashAlgorithm.Sha256: 119case SourceHashAlgorithm.Sha384: 122case SourceHashAlgorithm.Sha512: 234internal static ImmutableArray<byte> ComputeSourceHash(ImmutableArray<byte> bytes, SourceHashAlgorithm hashAlgorithm = SourceHashAlgorithms.Default) 246internal static ImmutableArray<byte> ComputeSourceHash(ImmutableArray<ConstantValue> constants, SourceHashAlgorithm hashAlgorithm = SourceHashAlgorithms.Default) 300internal static ImmutableArray<byte> ComputeSourceHash(IEnumerable<Blob> bytes, SourceHashAlgorithm hashAlgorithm = SourceHashAlgorithms.Default)
EmbeddedText.cs (6)
44public SourceHashAlgorithm ChecksumAlgorithm { get; } 52private EmbeddedText(string filePath, ImmutableArray<byte> checksum, SourceHashAlgorithm checksumAlgorithm, ImmutableArray<byte> blob) 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 (8)
73/// from <see cref="SourceText.From(Stream, Encoding, SourceHashAlgorithm, bool)"/> in two ways: 93SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 106SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 149SourceHashAlgorithm checksumAlgorithm, 249internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded) 252internal static SourceText Decode(Stream data, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected, bool canBeEmbedded)
PEWriter\DebugSourceInfo.cs (1)
34SourceHashAlgorithm checksumAlgorithm,
SourceGeneration\GeneratorAdaptor.cs (1)
88public GeneratorExecutionContext ToExecutionContext(string sourceExtension, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken)
SourceGeneration\GeneratorContexts.cs (3)
24private readonly SourceHashAlgorithm _checksumAlgorithm; 26internal GeneratorExecutionContext(Compilation compilation, ParseOptions parseOptions, ImmutableArray<AdditionalText> additionalTexts, AnalyzerConfigOptionsProvider optionsProvider, ISyntaxContextReceiver? syntaxReceiver, string sourceExtension, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken = default) 85public void AddSource(string hintName, string source) => AddSource(hintName, SourceText.From(source, Encoding.UTF8, checksumAlgorithm: _checksumAlgorithm == SourceHashAlgorithm.None ? SourceHashAlgorithms.Default : _checksumAlgorithm));
SourceGeneration\GeneratorDriverOptions.cs (1)
29internal SourceHashAlgorithm ChecksumAlgorithm { get; init; }
SourceGeneration\GeneratorDriverState.cs (1)
86internal SourceHashAlgorithm ChecksumAlgorithm => _driverOptions.ChecksumAlgorithm;
SourceGeneration\IncrementalContexts.cs (6)
274internal readonly SourceHashAlgorithm ChecksumAlgorithm; 276internal SourceProductionContext(AdditionalSourcesCollection sources, DiagnosticBag diagnostics, Compilation compilation, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken) 292public void AddSource(string hintName, string source) => AddSource(hintName, SourceText.From(source, Encoding.UTF8, checksumAlgorithm: ChecksumAlgorithm == SourceHashAlgorithm.None ? SourceHashAlgorithms.Default : ChecksumAlgorithm)); 332internal readonly SourceHashAlgorithm ChecksumAlgorithm; 334internal PreCompilationSourceProductionContext(AdditionalSourcesCollection sources, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken) 351public void AddSource(string hintName, string source) => AddSource(hintName, SourceText.From(source, Encoding.UTF8, checksumAlgorithm: ChecksumAlgorithm == SourceHashAlgorithm.None ? SourceHashAlgorithms.Default : ChecksumAlgorithm));
Syntax\SyntaxNode.cs (2)
327public SourceText GetText(Encoding? encoding = null, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1)
Syntax\SyntaxTree.cs (2)
31private SourceHashAlgorithm _lazyHashAlgorithm; 381Debug.Assert(_lazyHashAlgorithm != default(SourceHashAlgorithm));
Text\CompositeText.cs (3)
28private CompositeText(ImmutableArray<SourceText> segments, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm) 347var algorithm = segments[i].ChecksumAlgorithm; 403var algorithm = segments[0].ChecksumAlgorithm;
Text\LargeText.cs (4)
33internal LargeText(ImmutableArray<char[]> chunks, Encoding? encodingOpt, ImmutableArray<byte> checksum, SourceHashAlgorithm checksumAlgorithm, ImmutableArray<byte> embeddedTextBlob) 50internal LargeText(ImmutableArray<char[]> chunks, Encoding? encodingOpt, SourceHashAlgorithm checksumAlgorithm) 55internal static SourceText Decode(Stream stream, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected, bool canBeEmbedded) 81internal static SourceText Decode(TextReader reader, int length, Encoding? encodingOpt, SourceHashAlgorithm checksumAlgorithm)
Text\LargeTextWriter.cs (2)
15private readonly SourceHashAlgorithm _checksumAlgorithm; 22public LargeTextWriter(Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, int length)
Text\SourceHashAlgorithms.cs (30)
16public const SourceHashAlgorithm Default = SourceHashAlgorithm.Sha256; 23public const SourceHashAlgorithm OpenDocumentChecksumAlgorithm = Default; 30public static bool IsSupportedAlgorithm(SourceHashAlgorithm algorithm) 33SourceHashAlgorithm.Sha1 => true, 34SourceHashAlgorithm.Sha256 => true, 35SourceHashAlgorithm.Sha384 => true, 36SourceHashAlgorithm.Sha512 => true, 40public static Guid GetAlgorithmGuid(SourceHashAlgorithm algorithm) 43SourceHashAlgorithm.Sha1 => s_guidSha1, 44SourceHashAlgorithm.Sha256 => s_guidSha256, 45SourceHashAlgorithm.Sha384 => s_guidSha384, 46SourceHashAlgorithm.Sha512 => s_guidSha512, 50public static SourceHashAlgorithm GetSourceHashAlgorithm(Guid guid) 51=> (guid == s_guidSha256) ? SourceHashAlgorithm.Sha256 : 52(guid == s_guidSha1) ? SourceHashAlgorithm.Sha1 : 53(guid == s_guidSha384) ? SourceHashAlgorithm.Sha384 : 54(guid == s_guidSha512) ? SourceHashAlgorithm.Sha512 : 55SourceHashAlgorithm.None; 57private static HashAlgorithm CreateInstance(SourceHashAlgorithm algorithm) 62SourceHashAlgorithm.Sha1 => SHA1.Create(), 63SourceHashAlgorithm.Sha256 => SHA256.Create(), 64SourceHashAlgorithm.Sha384 => SHA384.Create(), 65SourceHashAlgorithm.Sha512 => SHA512.Create(), 75public static bool TryParseAlgorithmName(string name, out SourceHashAlgorithm algorithm) 79algorithm = SourceHashAlgorithm.Sha1; 85algorithm = SourceHashAlgorithm.Sha256; 91algorithm = SourceHashAlgorithm.Sha384; 97algorithm = SourceHashAlgorithm.Sha512; 101algorithm = SourceHashAlgorithm.None;
Text\SourceText.cs (25)
38private readonly SourceHashAlgorithm _checksumAlgorithm; 52protected SourceText(ImmutableArray<byte> checksum = default, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, SourceTextContainer? container = null) 66internal SourceText(ImmutableArray<byte> checksum, SourceHashAlgorithm checksumAlgorithm, ImmutableArray<byte> embeddedTextBlob) 84internal static void ValidateChecksumAlgorithm(SourceHashAlgorithm checksumAlgorithm) 107public static SourceText From(string text, Encoding? encoding = null, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1) 137SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1) 156public static SourceText From(Stream stream, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected) 185SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 227public static SourceText From(byte[] buffer, int length, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected) 255SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 386public SourceHashAlgorithm ChecksumAlgorithm => _checksumAlgorithm; 426/// If this text was constructed via <see cref="From(byte[], int, Encoding, SourceHashAlgorithm, bool, bool)"/> or 427/// <see cref="From(Stream, Encoding, SourceHashAlgorithm, bool, bool)"/>, then the canBeEmbedded arg must have 687internal static ImmutableArray<byte> CalculateChecksum(byte[] buffer, int offset, int count, SourceHashAlgorithm algorithmId) 696internal static ImmutableArray<byte> CalculateChecksum(Stream stream, SourceHashAlgorithm algorithmId) 1361/// If <paramref name="checksumAlgorithm"/> is <see cref="SourceHashAlgorithm.None"/>, returns this instance without modification. 1364internal SourceText WithChecksumAlgorithmIfAny(SourceHashAlgorithm checksumAlgorithm) 1366if (checksumAlgorithm == SourceHashAlgorithm.None || checksumAlgorithm == ChecksumAlgorithm) 1376public SourceTextWithAlgorithm(SourceText underlying, SourceHashAlgorithm checksumAlgorithm) : base(checksumAlgorithm: checksumAlgorithm) 1378Debug.Assert(checksumAlgorithm != SourceHashAlgorithm.None);
Text\SourceTextWriter.cs (1)
14public static SourceTextWriter Create(Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, int length)
Text\StringBuilderText.cs (1)
24public StringBuilderText(StringBuilder builder, Encoding? encodingOpt, SourceHashAlgorithm checksumAlgorithm)
Text\StringText.cs (2)
27SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1,
Text\StringTextWriter.cs (2)
21private readonly SourceHashAlgorithm _checksumAlgorithm; 23public StringTextWriter(Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, int capacity)
Microsoft.CodeAnalysis.Analyzers (9)
src\roslyn\src\Compilers\Core\Portable\EncodedStringText.cs (8)
73/// from <see cref="SourceText.From(Stream, Encoding, SourceHashAlgorithm, bool)"/> in two ways: 93SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 106SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 149SourceHashAlgorithm checksumAlgorithm, 249internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded) 252internal static SourceText Decode(Stream data, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected, bool canBeEmbedded)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\AdditionalTextExtensions.cs (1)
15private static readonly SourceText s_emptySourceText = SourceText.From("", s_utf8bom, SourceHashAlgorithm.Sha256);
Microsoft.CodeAnalysis.AnalyzerUtilities (9)
src\roslyn\src\Compilers\Core\Portable\EncodedStringText.cs (8)
73/// from <see cref="SourceText.From(Stream, Encoding, SourceHashAlgorithm, bool)"/> in two ways: 93SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 106SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 149SourceHashAlgorithm checksumAlgorithm, 249internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded) 252internal static SourceText Decode(Stream data, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected, bool canBeEmbedded)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\AdditionalTextExtensions.cs (1)
15private static readonly SourceText s_emptySourceText = SourceText.From("", s_utf8bom, SourceHashAlgorithm.Sha256);
Microsoft.CodeAnalysis.CodeStyle (8)
src\roslyn\src\Compilers\Core\Portable\EncodedStringText.cs (8)
73/// from <see cref="SourceText.From(Stream, Encoding, SourceHashAlgorithm, bool)"/> in two ways: 93SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 106SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 149SourceHashAlgorithm checksumAlgorithm, 249internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded) 252internal static SourceText Decode(Stream data, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected, bool canBeEmbedded)
Microsoft.CodeAnalysis.CSharp (14)
CommandLine\CSharpCommandLineParser.cs (2)
112var checksumAlgorithm = SourceHashAlgorithms.Default; 401if (!SourceHashAlgorithms.TryParseAlgorithmName(value!, out var newChecksumAlgorithm))
CommandLine\CSharpCompiler.cs (1)
376private protected override GeneratorDriver CreateGeneratorDriver(string baseDirectory, ParseOptions parseOptions, ImmutableArray<ISourceGenerator> generators, AnalyzerConfigOptionsProvider analyzerConfigOptionsProvider, ImmutableArray<AdditionalText> additionalTexts, SourceHashAlgorithm checksumAlgorithm)
Syntax\CSharpSyntaxTree.cs (5)
347checksumAlgorithm: SourceHashAlgorithm.Sha1, 361SourceHashAlgorithm checksumAlgorithm) 401checksumAlgorithm: SourceHashAlgorithm.Sha1, 459return ParseText(SourceText.From(text, encoding, SourceHashAlgorithm.Sha1), options, path, diagnosticOptions, isGeneratedCode, cancellationToken); 920=> ParseText(SourceText.From(text, encoding, SourceHashAlgorithm.Sha1), options, path, diagnosticOptions, isGeneratedCode: null, cancellationToken);
Syntax\CSharpSyntaxTree.Dummy.cs (2)
19private const SourceHashAlgorithm ChecksumAlgorithm = SourceHashAlgorithm.Sha1;
Syntax\CSharpSyntaxTree.ParsedSyntaxTree.cs (2)
27private readonly SourceHashAlgorithm _checksumAlgorithm; 34SourceHashAlgorithm checksumAlgorithm,
Syntax\SyntaxFactory.cs (2)
1577=> CSharpSyntaxTree.Create((CSharpSyntaxNode)root, (CSharpParseOptions?)options ?? CSharpParseOptions.Default, path, encoding, SourceHashAlgorithm.Sha1); 1591return CSharpSyntaxTree.ParseText(SourceText.From(text, encoding, SourceHashAlgorithm.Sha1), (CSharpParseOptions?)options, path, diagnosticOptions: null, isGeneratedCode: null, cancellationToken);
Microsoft.CodeAnalysis.CSharp.Workspaces (3)
Workspace\LanguageServices\CSharpSyntaxTreeFactoryService.cs (1)
58public override SyntaxTree CreateSyntaxTree(string filePath, ParseOptions options, SourceText text, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, SyntaxNode root)
Workspace\LanguageServices\CSharpSyntaxTreeFactoryService.ParsedSyntaxTree.cs (2)
20private readonly SourceHashAlgorithm _checksumAlgorithm; 34SourceHashAlgorithm checksumAlgorithm)
Microsoft.CodeAnalysis.ExternalAccess.HotReload (1)
Api\HotReloadMSBuildWorkspace.cs (1)
210private static async ValueTask<SourceText> GetSourceTextAsync(string filePath, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.Features (21)
EditAndContinue\CommittedSolution.cs (7)
329var maybePdbHasDocument = TryReadSourceFileDebugInfo(document, sourceText.Encoding, out var requiredChecksum, out var checksumAlgorithm, out var defaultEncoding); 372SourceHashAlgorithm checksumAlgorithm, 440private static bool IsMatchingSourceText(SourceText sourceText, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm) 448SourceHashAlgorithm checksumAlgorithm) 475private bool? TryReadSourceFileDebugInfo(Document document, Encoding? documentEncoding, out ImmutableArray<byte> checksum, out SourceHashAlgorithm checksumAlgorithm, out Encoding? defaultEncoding) 521out SourceHashAlgorithm algorithm) 535if (algorithm == SourceHashAlgorithm.None)
EditAndContinue\IPdbMatchingSourceTextProvider.cs (2)
15ValueTask<string?> TryGetMatchingSourceTextAsync(string filePath, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken); 26public ValueTask<string?> TryGetMatchingSourceTextAsync(string filePath, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken)
EditAndContinue\PdbMatchingSourceTextProvider.cs (1)
136public async ValueTask<string?> TryGetMatchingSourceTextAsync(string filePath, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken)
EditAndContinue\Remote\IRemoteEditAndContinueService.cs (1)
26ValueTask<string?> TryGetMatchingSourceTextAsync(RemoteServiceCallbackId callbackId, string filePath, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken);
EditAndContinue\Remote\RemoteEditAndContinueServiceProxy.cs (2)
35public ValueTask<string?> TryGetMatchingSourceTextAsync(RemoteServiceCallbackId callbackId, string filePath, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken) 56public async ValueTask<string?> TryGetMatchingSourceTextAsync(string filePath, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken)
MetadataAsSource\MetadataAsSourceGeneratedFileInfo.cs (1)
22public static SourceHashAlgorithm ChecksumAlgorithm => SourceHashAlgorithms.Default;
PdbSourceDocument\DocumentDebugInfoReader.cs (1)
48var hashAlgorithm = SourceHashAlgorithms.GetSourceHashAlgorithm(hashAlgorithmGuid);
PdbSourceDocument\IPdbSourceDocumentLoaderService.cs (1)
23internal sealed record SourceFileInfo(string FilePath, string SourceDescription, TextLoader Loader, SourceHashAlgorithm ChecksumAlgorithm, bool FromRemoteLocation);
PdbSourceDocument\PdbSourceDocumentMetadataAsSourceFileProvider.cs (4)
216var projectChecksumAlgorithm = sourceDocuments[0].ChecksumAlgorithm; 297private ProjectInfo? CreateProjectInfo(Workspace workspace, Project project, ImmutableDictionary<string, string> pdbCompilationOptions, string assemblyName, string assemblyVersion, SourceHashAlgorithm checksumAlgorithm) 434internal sealed record SourceDocument(string FilePath, SourceHashAlgorithm ChecksumAlgorithm, ImmutableArray<byte> Checksum, byte[]? EmbeddedTextBytes, string? SourceLinkUrl); 436internal record struct SourceDocumentInfo(DocumentId DocumentId, Encoding Encoding, SourceHashAlgorithm ChecksumAlgorithm, ProjectId SourceProjectId, Workspace SourceWorkspace, DocumentInfo DocumentInfo);
Workspace\MiscellaneousFileUtilities.cs (1)
30SourceHashAlgorithm checksumAlgorithm,
Microsoft.CodeAnalysis.Razor.Compiler (14)
Language\DefaultRazorCSharpLoweringPhase.cs (3)
87var algorithm = _context.SourceDocument.Text.ChecksumAlgorithm; 88if (algorithm == CodeAnalysis.Text.SourceHashAlgorithm.Sha256) 92else if (algorithm == CodeAnalysis.Text.SourceHashAlgorithm.Sha1)
Language\Extensions\MetadataAttributePass.cs (3)
109var checksumAlgorithm = codeDocument.Source.Text.ChecksumAlgorithm; 110if (checksum == null || checksum.Length == 0 || checksumAlgorithm is CodeAnalysis.Text.SourceHashAlgorithm.None) 132if (checksum == null || checksum.Length == 0 || checksumAlgorithm == CodeAnalysis.Text.SourceHashAlgorithm.None || identifier == null)
Language\Extensions\RazorSourceChecksumAttributeIntermediateNode.cs (1)
20public SourceHashAlgorithm ChecksumAlgorithm { get; set; }
Language\Legacy\SeekableTextReader.cs (1)
19public SeekableTextReader(string source, string filePath) : this(SourceText.From(source, checksumAlgorithm: SourceHashAlgorithm.Sha256), filePath)
Language\RazorSourceDocument.cs (6)
66var sourceText = SourceText.From(stream, checksumAlgorithm: SourceHashAlgorithm.Sha256); 90var sourceText = SourceText.From(stream, encoding, checksumAlgorithm: SourceHashAlgorithm.Sha256); 118var sourceText = SourceText.From(stream, encoding, checksumAlgorithm: SourceHashAlgorithm.Sha256); 153var sourceText = SourceText.From(stream, checksumAlgorithm: SourceHashAlgorithm.Sha256); 218var sourceText = SourceText.From(content, encoding, checksumAlgorithm: SourceHashAlgorithm.Sha256); 246var sourceText = SourceText.From(content, encoding, checksumAlgorithm: SourceHashAlgorithm.Sha256);
Microsoft.CodeAnalysis.Rebuild (7)
CompilationOptionsReader.cs (6)
189var hashAlgorithm = 190hashAlgorithmGuid == HashAlgorithmSha1 ? SourceHashAlgorithm.Sha1 191: hashAlgorithmGuid == HashAlgorithmSha256 ? SourceHashAlgorithm.Sha256 192: hashAlgorithmGuid == HashAlgorithmSha384 ? SourceHashAlgorithm.Sha384 193: hashAlgorithmGuid == HashAlgorithmSha512 ? SourceHashAlgorithm.Sha512 194: SourceHashAlgorithm.None;
Records.cs (1)
21SourceHashAlgorithm HashAlgorithm,
Microsoft.CodeAnalysis.ResxSourceGenerator (12)
AbstractResxGenerator.cs (3)
252var errorText = SourceText.From(text, Encoding.UTF8, SourceHashAlgorithm.Sha256); 392OutputText = SourceText.From(result, Encoding.UTF8, SourceHashAlgorithm.Sha256); 735OutputText = SourceText.From(result, Encoding.UTF8, SourceHashAlgorithm.Sha256);
src\roslyn\src\Compilers\Core\Portable\EncodedStringText.cs (8)
73/// from <see cref="SourceText.From(Stream, Encoding, SourceHashAlgorithm, bool)"/> in two ways: 93SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 106SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 149SourceHashAlgorithm checksumAlgorithm, 249internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded) 252internal static SourceText Decode(Stream data, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected, bool canBeEmbedded)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\AdditionalTextExtensions.cs (1)
15private static readonly SourceText s_emptySourceText = SourceText.From("", s_utf8bom, SourceHashAlgorithm.Sha256);
Microsoft.CodeAnalysis.VisualBasic (11)
CommandLine\VisualBasicCommandLineParser.vb (1)
358Dim newChecksumAlgorithm As SourceHashAlgorithm
CommandLine\VisualBasicCompiler.vb (1)
301Private Protected Overrides Function CreateGeneratorDriver(baseDirectory As String, parseOptions As ParseOptions, generators As ImmutableArray(Of ISourceGenerator), analyzerConfigOptionsProvider As AnalyzerConfigOptionsProvider, additionalTexts As ImmutableArray(Of AdditionalText), checksumAlgorithm As SourceHashAlgorithm) As GeneratorDriver
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 (2)
16Private Const ChecksumAlgorithm As SourceHashAlgorithm = SourceHashAlgorithm.Sha1
Syntax\VisualBasicSyntaxTree.ParsedSyntaxTree.vb (2)
28Private ReadOnly _checksumAlgorithm As SourceHashAlgorithm 38checksumAlgorithm As SourceHashAlgorithm,
Syntax\VisualBasicSyntaxTree.vb (3)
175checksumAlgorithm:=SourceHashAlgorithm.Sha1, 187checksumAlgorithm As SourceHashAlgorithm) As SyntaxTree 223checksumAlgorithm:=SourceHashAlgorithm.Sha1,
Microsoft.CodeAnalysis.VisualBasic.Workspaces (3)
Workspace\LanguageServices\VisualBasicSyntaxTreeFactoryService.ParsedSyntaxTree.vb (2)
19Private ReadOnly _checksumAlgorithm As SourceHashAlgorithm 33checksumAlgorithm As SourceHashAlgorithm)
Workspace\LanguageServices\VisualBasicSyntaxTreeFactoryService.vb (1)
72Public Overrides Function CreateSyntaxTree(filePath As String, options As ParseOptions, text As SourceText, encoding As Encoding, checksumAlgorithm As SourceHashAlgorithm, root As SyntaxNode) As SyntaxTree
Microsoft.CodeAnalysis.Workspaces (73)
Serialization\SerializableSourceText.cs (4)
179var checksumAlgorithm = (SourceHashAlgorithm)reader.ReadInt32(); 188var checksumAlgorithm = (SourceHashAlgorithm)reader.ReadInt32();
Shared\Extensions\SourceTextExtensions.cs (1)
226public static SourceText ReadFrom(ITextFactoryService textService, ObjectReader reader, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken)
SourceGeneration\IRemoteSourceGenerationService.cs (1)
90[property: DataMember(Order = 2)] SourceHashAlgorithm ChecksumAlgorithm);
src\roslyn\src\Compilers\Core\Portable\EncodedStringText.cs (8)
73/// from <see cref="SourceText.From(Stream, Encoding, SourceHashAlgorithm, bool)"/> in two ways: 93SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 106SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 149SourceHashAlgorithm checksumAlgorithm, 249internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded) 252internal static SourceText Decode(Stream data, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected, bool canBeEmbedded)
src\roslyn\src\Compilers\Core\Portable\Text\SourceHashAlgorithms.cs (30)
16public const SourceHashAlgorithm Default = SourceHashAlgorithm.Sha256; 23public const SourceHashAlgorithm OpenDocumentChecksumAlgorithm = Default; 30public static bool IsSupportedAlgorithm(SourceHashAlgorithm algorithm) 33SourceHashAlgorithm.Sha1 => true, 34SourceHashAlgorithm.Sha256 => true, 35SourceHashAlgorithm.Sha384 => true, 36SourceHashAlgorithm.Sha512 => true, 40public static Guid GetAlgorithmGuid(SourceHashAlgorithm algorithm) 43SourceHashAlgorithm.Sha1 => s_guidSha1, 44SourceHashAlgorithm.Sha256 => s_guidSha256, 45SourceHashAlgorithm.Sha384 => s_guidSha384, 46SourceHashAlgorithm.Sha512 => s_guidSha512, 50public static SourceHashAlgorithm GetSourceHashAlgorithm(Guid guid) 51=> (guid == s_guidSha256) ? SourceHashAlgorithm.Sha256 : 52(guid == s_guidSha1) ? SourceHashAlgorithm.Sha1 : 53(guid == s_guidSha384) ? SourceHashAlgorithm.Sha384 : 54(guid == s_guidSha512) ? SourceHashAlgorithm.Sha512 : 55SourceHashAlgorithm.None; 57private static HashAlgorithm CreateInstance(SourceHashAlgorithm algorithm) 62SourceHashAlgorithm.Sha1 => SHA1.Create(), 63SourceHashAlgorithm.Sha256 => SHA256.Create(), 64SourceHashAlgorithm.Sha384 => SHA384.Create(), 65SourceHashAlgorithm.Sha512 => SHA512.Create(), 75public static bool TryParseAlgorithmName(string name, out SourceHashAlgorithm algorithm) 79algorithm = SourceHashAlgorithm.Sha1; 85algorithm = SourceHashAlgorithm.Sha256; 91algorithm = SourceHashAlgorithm.Sha384; 97algorithm = SourceHashAlgorithm.Sha512; 101algorithm = SourceHashAlgorithm.None;
TemporaryStorage\TemporaryStorageService.cs (3)
185SourceHashAlgorithm checksumAlgorithm, 249SourceHashAlgorithm checksumAlgorithm, 255public SourceHashAlgorithm ChecksumAlgorithm => checksumAlgorithm;
Workspace\Host\SyntaxTreeFactory\AbstractSyntaxTreeFactoryService.cs (1)
20public abstract SyntaxTree CreateSyntaxTree(string filePath, ParseOptions options, SourceText text, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, SyntaxNode root);
Workspace\Host\SyntaxTreeFactory\ISyntaxTreeFactoryService.cs (1)
30SyntaxTree CreateSyntaxTree(string? filePath, ParseOptions options, SourceText? text, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, SyntaxNode root);
Workspace\Host\TextFactory\ITextFactoryService.cs (2)
33SourceText CreateText(Stream stream, Encoding? defaultEncoding, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken); 43SourceText CreateText(TextReader reader, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken);
Workspace\Host\TextFactory\TextFactoryService.cs (2)
25public SourceText CreateText(Stream stream, Encoding? defaultEncoding, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken) 31public SourceText CreateText(TextReader reader, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken)
Workspace\ProjectSystem\ProjectSystemProject.cs (1)
429public SourceHashAlgorithm ChecksumAlgorithm
Workspace\Solution\DocumentState.cs (2)
303public DocumentState UpdateChecksumAlgorithm(SourceHashAlgorithm checksumAlgorithm) 533SourceHashAlgorithm checksumAlgorithm,
Workspace\Solution\LoadTextOptions.cs (2)
15public SourceHashAlgorithm ChecksumAlgorithm { get; } 17public LoadTextOptions(SourceHashAlgorithm checksumAlgorithm)
Workspace\Solution\ProjectInfo.cs (9)
88internal SourceHashAlgorithm ChecksumAlgorithm => Attributes.ChecksumAlgorithm; 240checksumAlgorithm: SourceHashAlgorithm.Sha1, 362internal ProjectInfo WithChecksumAlgorithm(SourceHashAlgorithm checksumAlgorithm) 419SourceHashAlgorithm checksumAlgorithm, 488public SourceHashAlgorithm ChecksumAlgorithm { get; } = checksumAlgorithm; 543Optional<SourceHashAlgorithm> checksumAlgorithm = default, 559var newChecksumAlgorithm = checksumAlgorithm.HasValue ? checksumAlgorithm.Value : ChecksumAlgorithm; 643var checksumAlgorithm = (SourceHashAlgorithm)reader.ReadByte();
Workspace\Solution\ProjectState.cs (3)
634public SourceHashAlgorithm ChecksumAlgorithm => this.ProjectInfo.ChecksumAlgorithm; 752public ProjectState WithChecksumAlgorithm(SourceHashAlgorithm checksumAlgorithm) 764private TextDocumentStates<DocumentState> UpdateDocumentsChecksumAlgorithm(SourceHashAlgorithm checksumAlgorithm)
Workspace\Solution\Solution.cs (1)
452internal Solution WithProjectChecksumAlgorithm(ProjectId projectId, SourceHashAlgorithm checksumAlgorithm)
Workspace\Solution\SolutionCompilationState.cs (1)
474ProjectId projectId, SourceHashAlgorithm checksumAlgorithm)
Workspace\Solution\SolutionState.cs (1)
629public StateChange WithProjectChecksumAlgorithm(ProjectId projectId, SourceHashAlgorithm checksumAlgorithm)
Microsoft.CodeAnalysis.Workspaces.MSBuild (2)
MSBuild\MSBuildProjectLoader.Worker.cs (2)
207SourceHashAlgorithm checksumAlgorithm; 260checksumAlgorithm = !string.IsNullOrEmpty(projectFileInfo.ChecksumAlgorithm) && SourceHashAlgorithms.TryParseAlgorithmName(projectFileInfo.ChecksumAlgorithm, out var algorithm)
Roslyn.Diagnostics.Analyzers (9)
src\roslyn\src\Compilers\Core\Portable\EncodedStringText.cs (8)
73/// from <see cref="SourceText.From(Stream, Encoding, SourceHashAlgorithm, bool)"/> in two ways: 93SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 106SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 149SourceHashAlgorithm checksumAlgorithm, 249internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded) 252internal static SourceText Decode(Stream data, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected, bool canBeEmbedded)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\AdditionalTextExtensions.cs (1)
15private static readonly SourceText s_emptySourceText = SourceText.From("", s_utf8bom, SourceHashAlgorithm.Sha256);