Integrity checks. More...
Defines | |
#define | LZMA_CHECK_ID_MAX 15 |
Maximum valid Check ID. | |
#define | LZMA_CHECK_SIZE_MAX 64 |
Maximum size of a Check field. | |
Enumerations | |
enum | lzma_check { LZMA_CHECK_NONE = 0, LZMA_CHECK_CRC32 = 1, LZMA_CHECK_CRC64 = 4, LZMA_CHECK_SHA256 = 10 } |
Type of the integrity check (Check ID). More... | |
Functions | |
LZMA_API (lzma_bool) lzma_check_is_supported(lzma_check check) lzma_attr_const | |
Test if the given Check ID is supported. | |
LZMA_API (uint32_t) lzma_check_size(lzma_check check) lzma_attr_const | |
Get the size of the Check field with the given Check ID. | |
LZMA_API (uint64_t) lzma_crc64(const uint8_t *buf | |
Calculate CRC64. | |
LZMA_API (lzma_check) lzma_get_check(const lzma_stream *strm) | |
Get the type of the integrity check. | |
Variables | |
size_t | size |
size_t uint32_t crc | lzma_attr_pure |
Integrity checks.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
#define LZMA_CHECK_ID_MAX 15 |
Maximum valid Check ID.
The .xz file format specification specifies 16 Check IDs (0-15). Some of them are only reserved, that is, no actual Check algorithm has been assigned. When decoding, liblzma still accepts unknown Check IDs for future compatibility. If a valid but unsupported Check ID is detected, liblzma can indicate a warning; see the flags LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK, and LZMA_TELL_ANY_CHECK in container.h.
#define LZMA_CHECK_SIZE_MAX 64 |
Maximum size of a Check field.
enum lzma_check |
Type of the integrity check (Check ID).
The .xz format supports multiple types of checks that are calculated from the uncompressed data. They very in both speed and ability to detect errors.
LZMA_API | ( | lzma_bool | ) | const |
Test if the given Check ID is supported.
Set a compression preset to lzma_options_lzma structure.
Test if given compression mode is supported.
Compare if two Index lists are identical.
Locate a Record.
Test if the given Filter ID is supported for decoding.
Returns true if the given Check ID is supported by this liblzma build. Otherwise false is returned. It is safe to call this with a value that is not in the range [0, 15]; in that case the return value is always false.
You can assume that LZMA_CHECK_NONE and LZMA_CHECK_CRC32 are always supported (even if liblzma is built with limited features).
Returns true if the give Filter ID is supported for decoding by this liblzma build. Otherwise false is returned.
When the Index is available, it is possible to do random-access reading with granularity of Block size.
i | Pointer to lzma_index structure | |
record | Pointer to a structure to hold the search results | |
target | Uncompressed target offset which the caller would like to locate from the Stream |
If the target is smaller than the uncompressed size of the Stream (can be checked with lzma_index_uncompressed_size()):
If target is greater than the uncompressed size of the Stream, *record and the read position are not modified, and this function returns true.
Returns true if the given compression mode is supported by this liblzma build. Otherwise false is returned. It is safe to call this with a value that isn't listed in lzma_mode enumeration; the return value will be false.
There is no way to list which modes are available in this particular liblzma version and build. It would be useless, because a new compression mode, which the application developer wasn't aware, could require giving additional options to the encoder that the older modes don't need.
0 is the fastest and 9 is the slowest. These match the switches -0 .. -9 of the xz command line tool. In addition, it is possible to bitwise-or flags to the preset. Currently only LZMA_PRESET_EXTREME is supported. The flags are defined in container.h, because the flags are used also with lzma_easy_encoder().
The preset values are subject to changes between liblzma versions.
This function is available only if LZMA1 or LZMA2 encoder has been enabled when building liblzma.
Test if the given Check ID is supported.
Compare if two Index lists are identical.
Locate a Record.
When the Index is available, it is possible to do random-access reading with granularity of Block size.
i | Pointer to lzma_index structure | |
record | Pointer to a structure to hold the search results | |
target | Uncompressed target offset which the caller would like to locate from the Stream |
If the target is smaller than the uncompressed size of the Stream (can be checked with lzma_index_uncompressed_size()):
If target is greater than the uncompressed size of the Stream, *record and the read position are not modified, and this function returns true.
Test if the given Check ID is supported.
Set a compression preset to lzma_options_lzma structure.
Test if given compression mode is supported.
Returns true if the given match finder is supported by this liblzma build. Otherwise false is returned. It is safe to call this with a value that isn't listed in lzma_match_finder enumeration; the return value will be false.
There is no way to list which match finders are available in this particular liblzma version and build. It would be useless, because a new match finder, which the application developer wasn't aware, could require giving additional options to the encoder that the older match finders don't need.
Returns true if the given compression mode is supported by this liblzma build. Otherwise false is returned. It is safe to call this with a value that isn't listed in lzma_mode enumeration; the return value will be false.
There is no way to list which modes are available in this particular liblzma version and build. It would be useless, because a new compression mode, which the application developer wasn't aware, could require giving additional options to the encoder that the older modes don't need.
0 is the fastest and 9 is the slowest. These match the switches -0 .. -9 of the xz command line tool. In addition, it is possible to bitwise-or flags to the preset. Currently only LZMA_PRESET_EXTREME is supported. The flags are defined in container.h, because the flags are used also with lzma_easy_encoder().
The preset values are subject to changes between liblzma versions.
This function is available only if LZMA1 or LZMA2 encoder has been enabled when building liblzma.
LZMA_API | ( | uint32_t | ) |
Get the size of the Check field with the given Check ID.
Get the number of bytes required to encode a VLI.
liblzma version number as an integer
Calculate CRC32.
Although not all Check IDs have a check algorithm associated, the size of every Check is already frozen. This function returns the size (in bytes) of the Check field with the specified Check ID. The values are: { 0, 4, 4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64, 64 }
If the argument is not in the range [0, 15], UINT32_MAX is returned.
Calculates CRC32 using the polynomial from the IEEE 802.3 standard.
buf | Pointer to the input buffer | |
size | Size of the input buffer | |
crc | Previously returned CRC value. This is used to calculate the CRC of a big buffer in smaller chunks. Set to zero when there is no previous value. |
LZMA_API | ( | uint64_t | ) | const |
Calculate CRC64.
Get the size of the Index field as bytes.
Calculate rough memory requirements for raw encoder.
Calculate Unpadded Size.
Get the memory usage of decoder filter chain.
Calculates CRC64 using the polynomial from the ECMA-182 standard.
This function is used similarly to lzma_crc32(). See its documentation.
References LZMA_VLI_UNKNOWN.
LZMA_API | ( | lzma_check | ) | const |
Get the type of the integrity check.
This function can be called only immediatelly after lzma_code() has returned LZMA_NO_CHECK, LZMA_UNSUPPORTED_CHECK, or LZMA_GET_CHECK. Calling this function in any other situation has undefined behavior.