Salt

public struct Salt

A salt should be applied to passwords prior to hashing in order to prevent dictionary attacks. This class represents such a salt.

  • The size of the salt in bytes.

    Declaration

    Swift

    public static let SizeInBytes: UInt32
  • The actual salt bytes.

    Declaration

    Swift

    public let bytes: Bytes
  • Initializes a random salt.

    Declaration

    Swift

    public init()
  • Initializes a salt from a byte array.

    Warning

    This should only be used to reconstruct salt bytes generated with Salt(). Do not use this for hardcoded values.

    Declaration

    Swift

    public init?(bytes: Bytes)

    Parameters

    bytes

    The bytes of the salt.