ByteExtensions¶
Byte-array helpers for locating a known signature (e.g. a PDF header), stripping a leading header, and hashing a payload. (BR-053, BR-054, BR-056)
Purpose¶
- Byte-array helpers for locating a known signature (e.g. a PDF header), stripping a leading header, and hashing a payload. (BR-053, BR-054, BR-056)
Context¶
- Namespace:
SAIF.Common.Extensions - Assembly/package:
SAIF.Framework.Common
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| PDF_FILE_HEADER | public const string PDF_FILE_HEADER = "%PDF-" |
Well-known signature identifying a PDF file's leading bytes. |
| Search(this byte[] source, string signature, int startIndex, int endIndex) | public static int Search(this byte[] source, string signature, int startIndex, int endIndex) |
Finds the index of a string signature within a byte range, or -1 if not found. (BR-053, BR-054) |
| Search(this byte[] source, byte[] signature, int startIndex, int endIndex) | public static int Search(this byte[] source, byte[] signature, int startIndex, int endIndex) |
Finds the index of a byte signature within a byte range, or -1 if not found. (BR-054) |
| StripHeader(this byte[] source, string signature, out bool found, int maxSearchLength) | public static byte[] StripHeader(this byte[] source, string signature, out bool found, int maxSearchLength) |
Removes bytes preceding a located signature, reporting whether the signature was found. (BR-055, BR-056) |
| GetMD5Hash(this byte[] source) | public static string GetMD5Hash(this byte[] source) |
Computes the MD5 hash of the byte array and renders it as a hex string. (BR-057) |
Sources¶
Common/SAIF.Common/Extensions/ByteExtensions.cs