Cipher.swift 620 B

1234567891011121314151617181920212223242526
  1. //
  2. // Cipher.swift
  3. // CryptoSwift
  4. //
  5. // Created by Marcin Krzyzanowski on 29/05/16.
  6. // Copyright © 2016 Marcin Krzyzanowski. All rights reserved.
  7. //
  8. public enum CipherError: Error {
  9. case encrypt
  10. case decrypt
  11. }
  12. public protocol Cipher {
  13. /// Encrypt given bytes at once
  14. ///
  15. /// - parameter bytes: Plaintext data
  16. /// - returns: Encrypted data
  17. func encrypt(_ bytes: Array<UInt8>) throws -> Array<UInt8>
  18. /// Decrypt given bytes at once
  19. ///
  20. /// - parameter bytes: Ciphertext data
  21. /// - returns: Plaintext data
  22. func decrypt(_ bytes: Array<UInt8>) throws -> Array<UInt8>
  23. }