DataPadder

internal final class DataPadder

Utility class for padding and unpadding data to a specific block size.

  • Pad a Data object to the specified block size.

    Declaration

    Swift

    internal static func pad(data: Data, blockSize size: Int) -> [UInt8]

    Parameters

    data

    The Data to be padded.

    size

    The desired block size.

    Return Value

    Padded data as an array of UInt8.

  • Pad a byte array to the specified block size.

    Declaration

    Swift

    internal static func pad(data: [UInt8], blockSize size: Int) -> [UInt8]

    Parameters

    data

    The byte array to be padded.

    size

    The desired block size.

    Return Value

    Padded data as an array of UInt8.

  • Remove padding from a padded byte array.

    Declaration

    Swift

    internal static func unpad(data: [UInt8]) -> [UInt8]

    Parameters

    data

    The padded byte array.

    Return Value

    The original data with padding removed.