# Data Extension Reference



## Scope and provenance

- Product: mobile
- Status: Imported reference snapshot. Import date is not a verification date or guarantee of current release support.
- SDK version: Not declared for this page. Versions in examples must not be assumed current.
- Environment: Page-specific. Confirm the environment host, credentials, and service configuration; do not infer them from another product.
- Source: https://documentation.idmission.com/identity/iOS-SDK-2/Extensions/Data.html
- Imported at: 2026-10-25T05:00:44.899Z
- Canonical page: https://docs.idmission.com/mobile/reference/ios/Extensions/Data
- Agent index: https://docs.idmission.com/llms.txt

---

<a id="data"></a>

# Data

```
extension Data
```

- <a id="/s:10Foundation4DataV17IDentitySDK_SwiftE5crc328checksums6UInt32VAH_tF"></a>

  <a id="//apple_ref/swift/Method/crc32(checksum:)"></a>

  `crc32(checksum:)`

  Calculate the `CRC32` checksum of the receiver.

  <a id="declaration"></a>

  #### Declaration

  Swift

  ```
  public func crc32(checksum: CRC32) -> CRC32
  ```

  <a id="parameters"></a>

  #### Parameters

  |            |                     |
  | ---------- | ------------------- |
  | `checksum` | The starting seed.  |

  <a id="return-value"></a>

  #### Return Value

  The checksum calculated from the bytes of the receiver and the starting seed.

- <a id="/s:10Foundation4DataV17IDentitySDK_SwiftE8compress4size10bufferSize8provider8consumers6UInt32Vs5Int64V_SiAcM_SitKXEyACKXEtKFZ"></a>

  <a id="//apple_ref/swift/Method/compress(size:bufferSize:provider:consumer:)"></a>

  `compress(size:bufferSize:provider:consumer:)`

  Compress the output of `provider` and pass it to `consumer`.

  <a id="declaration-2"></a>

  #### Declaration

  Swift

  ```
  public static func compress(size: Int64, bufferSize: Int, provider: Provider, consumer: Consumer) throws -> CRC32
  ```

  <a id="parameters-2"></a>

  #### Parameters

  |              |                                                                              |
  | ------------ | ---------------------------------------------------------------------------- |
  | `size`       | The uncompressed size of the data to be compressed.                          |
  | `bufferSize` | The maximum size of the compression buffer.                                  |
  | `provider`   | A closure that accepts a position and a chunk size. Returns a `Data` chunk.  |
  | `consumer`   | A closure that processes the result of the compress operation.               |

  <a id="return-value-2"></a>

  #### Return Value

  The checksum of the processed content.

- <a id="/s:10Foundation4DataV17IDentitySDK_SwiftE10decompress4size10bufferSize9skipCRC328provider8consumers6UInt32Vs5Int64V_SiSbAcN_SitKXEyACKXEtKFZ"></a>

  <a id="//apple_ref/swift/Method/decompress(size:bufferSize:skipCRC32:provider:consumer:)"></a>

  `decompress(size:bufferSize:skipCRC32:provider:consumer:)`

  Decompress the output of `provider` and pass it to `consumer`.

  <a id="declaration-3"></a>

  #### Declaration

  Swift

  ```
  public static func decompress(size: Int64, bufferSize: Int, skipCRC32: Bool,
                                provider: Provider, consumer: Consumer) throws -> CRC32
  ```

  <a id="parameters-3"></a>

  #### Parameters

  |              |                                                                                  |
  | ------------ | -------------------------------------------------------------------------------- |
  | `size`       | The compressed size of the data to be decompressed.                              |
  | `bufferSize` | The maximum size of the decompression buffer.                                    |
  | `skipCRC32`  | Optional flag to skip calculation of the CRC32 checksum to improve performance.  |
  | `provider`   | A closure that accepts a position and a chunk size. Returns a `Data` chunk.      |
  | `consumer`   | A closure that processes the result of the decompress operation.                 |

  <a id="return-value-3"></a>

  #### Return Value

  The checksum of the processed content.

- <a id="/s:10Foundation4DataV17IDentitySDK_SwiftE8compress4size10bufferSize8provider8consumers6UInt32VSi_SiACSi_SitKXEyACKXEtKFZ"></a>

  `compress(size:bufferSize:provider:consumer:)`

  <a id="declaration-4"></a>

  #### Declaration

  Swift

  ```
  static func compress(size: Int, bufferSize: Int,
                       provider: (_ position: Int, _ size: Int) throws -> Data,
                       consumer: Consumer) throws -> CRC32
  ```

- <a id="/s:10Foundation4DataV17IDentitySDK_SwiftE10decompress4size10bufferSize9skipCRC328provider8consumers6UInt32VSi_SiSbACSi_SitKXEyACKXEtKFZ"></a>

  `decompress(size:bufferSize:skipCRC32:provider:consumer:)`

  <a id="declaration-5"></a>

  #### Declaration

  Swift

  ```
  static func decompress(size: Int, bufferSize: Int, skipCRC32: Bool,
                         provider: (_ position: Int, _ size: Int) throws -> Data,
                         consumer: Consumer) throws -> CRC32
  ```

<a id="footer"></a>

© 2024 [IDmission](https://www.idmission.com/). All rights reserved. (Last updated: 2024-08-27)

Generated by [jazzy ♪♫ v0.14.2](https://github.com/realm/jazzy), a [Realm](https://realm.io/) project.
