|
@@ -25,10 +25,22 @@ public protocol Cipher: class {
|
|
/// - parameter bytes: Plaintext data
|
|
/// - parameter bytes: Plaintext data
|
|
/// - returns: Encrypted data
|
|
/// - returns: Encrypted data
|
|
func encrypt(_ bytes: ArraySlice<UInt8>) throws -> Array<UInt8>
|
|
func encrypt(_ bytes: ArraySlice<UInt8>) throws -> Array<UInt8>
|
|
|
|
+ func encrypt(_ bytes: Array<UInt8>) throws -> Array<UInt8>
|
|
|
|
|
|
/// Decrypt given bytes at once
|
|
/// Decrypt given bytes at once
|
|
///
|
|
///
|
|
/// - parameter bytes: Ciphertext data
|
|
/// - parameter bytes: Ciphertext data
|
|
/// - returns: Plaintext data
|
|
/// - returns: Plaintext data
|
|
func decrypt(_ bytes: ArraySlice<UInt8>) throws -> Array<UInt8>
|
|
func decrypt(_ bytes: ArraySlice<UInt8>) throws -> Array<UInt8>
|
|
|
|
+ func decrypt(_ bytes: Array<UInt8>) throws -> Array<UInt8>
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+extension Cipher {
|
|
|
|
+ public func encrypt(_ bytes: Array<UInt8>) throws -> Array<UInt8> {
|
|
|
|
+ return try encrypt(bytes.slice)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public func decrypt(_ bytes: Array<UInt8>) throws -> Array<UInt8> {
|
|
|
|
+ return try decrypt(bytes.slice)
|
|
|
|
+ }
|
|
}
|
|
}
|