Ejemplo n.º 1
0
        private static unsafe void EvaluateContentSignatures(Stream fileStream, Evaluator evaluator)
        {
            fileStream.Seek(0, SeekOrigin.Begin);

            var matches = SignatureScanner.Scan(_fileContentSignatures, fileStream);

            foreach (var match in matches)
            {
                foreach (var type in _signatureTypeLookup[match.Signature])
                {
                    evaluator.Add(type, POINTS_SIG_CONTENT);
                }
            }
        }
Ejemplo n.º 2
0
        private static unsafe void EvaluateMagicSignatures(Stream fileStream, Evaluator evaluator)
        {
            fileStream.Seek(0, SeekOrigin.Begin);

            var alloc     = new byte[_longestMagicSignatureLength];
            var bytesRead = fileStream.Read(alloc);
            var buffer    = new Memory <byte>(alloc, 0, Math.Min(bytesRead, _longestMagicSignatureLength));

            var matches = SignatureScanner.Scan(_fileMagicSignatures, buffer.Slice(0, bytesRead));

            foreach (var match in matches)
            {
                if (match.Offset != 0)
                {
                    continue;
                }

                foreach (var type in _signatureTypeLookup[match.Signature])
                {
                    evaluator.Add(type, POINTS_SIG_MAGIC);
                }
            }
        }