Cipher.swift 599 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: ErrorType {
  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: [UInt8]) throws -> [UInt8]
  18. /// Decrypt given bytes at once
  19. ///
  20. /// - parameter bytes: Ciphertext data
  21. /// - returns: Plaintext data
  22. func decrypt(bytes: [UInt8]) throws -> [UInt8]
  23. }