Obfuscator

public struct Obfuscator

The struct that encapsulates decoding and encoding process of strings obfuscation

Init

  • Initialize new instanse of Obfuscator struct with given salt string

    Declaration

    Swift

    public init(with salt: String)

    Parameters

    salt

    salt which will be used for encoding and decoding of string for obfuscation, should not be empty

    Return Value

    new instanse of Obfuscator struct

Public

  • Encode given string parameter with salt provided early in init

    Declaration

    Swift

    public func obfuscatingBytes(from string: String) -> [UInt8]

    Parameters

    string

    original string for obfuscation

    Return Value

    array of bytes

  • Decode given bytes to original string. The salt must be the same as the one used in obfuscatingBytes(from:) function.

    Declaration

    Swift

    public func revealString(from bytes: [UInt8]) -> String?

    Parameters

    bytes

    array of bytes

    Return Value

    Optional original string

  • Decode given bytes to original string. The salt must be the same as the one used in obfuscatingBytes(from:) function.

    Declaration

    Swift

    public func revealData(from bytes: [UInt8]) -> Data

    Parameters

    bytes

    array of bytes

    Return Value

    Data representation of original string