dissect.evidence.asdf.streams
¶
Module Contents¶
Classes¶
Convenience class for easy sub stream subclassing. |
|
Compute a CRC32 over all written data. |
|
Compute a hash over all written data. |
|
Compress data as it's being written. |
- class dissect.evidence.asdf.streams.SubStreamBase(fh: BinaryIO)¶
Bases:
io.RawIOBase
Convenience class for easy sub stream subclassing.
Additionally adds the finalize method.
- Parameters:
fh – The file-like object to wrap.
- fh¶
- tell() int ¶
Return current stream position.
- seek(pos: int, whence: int = io.SEEK_CUR) int ¶
Change stream position.
Change the stream position to the given byte offset. The offset is interpreted relative to the position indicated by whence. Values for whence are:
0 – start of stream (the default); offset should be zero or positive
1 – current stream position; offset may be negative
2 – end of stream; offset is usually negative
Return the new absolute position.
- close() None ¶
Flush and close the IO object.
This method has no effect if the file is already closed.
- finalize() None ¶
- class dissect.evidence.asdf.streams.Crc32Stream(fh: BinaryIO)¶
Bases:
SubStreamBase
Compute a CRC32 over all written data.
This assumes that all data is written as a continuous stream.
- Parameters:
fh – The file-like object to wrap.
- crc = 0¶
- finalize() None ¶
- class dissect.evidence.asdf.streams.HashedStream(fh: BinaryIO, alg: str = 'sha256')¶
Bases:
SubStreamBase
Compute a hash over all written data.
This assumes that all data is written as a continuous stream.
- Parameters:
fh – The file-like object to wrap.
alg – The hashing algorithm to use. Must be supported by hashlib.
- ctx¶
- hexdigest() str ¶
- close() None ¶
Flush and close the IO object.
This method has no effect if the file is already closed.