浏览代码

ChaCha20 and Rabbit is not UpdatableCryptor compatible (yet)

Marcin Krzyżanowski 9 年之前
父节点
当前提交
c02d262b96
共有 2 个文件被更改,包括 0 次插入82 次删除
  1. 0 41
      Sources/CryptoSwift/ChaCha20.swift
  2. 0 41
      Sources/CryptoSwift/Rabbit.swift

+ 0 - 41
Sources/CryptoSwift/ChaCha20.swift

@@ -162,47 +162,6 @@ final public class ChaCha20: BlockCipher {
     }
 }
 
-extension ChaCha20 {
-    public struct Encryptor: Cryptor {
-        let chacha20: ChaCha20
-
-        init(chacha20: ChaCha20) {
-            self.chacha20 = chacha20
-        }
-
-        public func update(withBytes bytes: [UInt8], isLast: Bool = false) throws -> [UInt8] {
-            return try chacha20.encrypt(bytes)
-        }
-    }
-}
-
-extension ChaCha20 {
-    public struct Decryptor: Cryptor {
-        let chacha20: ChaCha20
-
-        init(chacha20: ChaCha20) {
-            self.chacha20 = chacha20
-        }
-
-        public func update(withBytes bytes: [UInt8], isLast: Bool = false) throws -> [UInt8] {
-            return try chacha20.decrypt(bytes)
-        }
-    }
-}
-
-// MARK: - Cipher
-
-extension ChaCha20: UpdatableCryptor {
-
-    public func makeEncryptor() -> ChaCha20.Encryptor {
-        return Encryptor(chacha20: self)
-    }
-
-    public func makeDecryptor() -> ChaCha20.Decryptor {
-        return Decryptor(chacha20: self)
-    }
-}
-
 // MARK: Cipher
 extension ChaCha20: Cipher {
     public func encrypt(bytes:[UInt8]) throws -> [UInt8] {

+ 0 - 41
Sources/CryptoSwift/Rabbit.swift

@@ -173,47 +173,6 @@ final public class Rabbit: BlockCipher {
     }
 }
 
-extension Rabbit {
-    public struct Encryptor: Cryptor {
-        let rabbit: Rabbit
-
-        init(rabbit: Rabbit) {
-            self.rabbit = rabbit
-        }
-
-        public func update(withBytes bytes: [UInt8], isLast: Bool = false) throws -> [UInt8] {
-            return rabbit.encrypt(bytes)
-        }
-    }
-}
-
-extension Rabbit {
-    public struct Decryptor: Cryptor {
-        let rabbit: Rabbit
-
-        init(rabbit: Rabbit) {
-            self.rabbit = rabbit
-        }
-
-        public func update(withBytes bytes: [UInt8], isLast: Bool = false) throws -> [UInt8] {
-            return rabbit.decrypt(bytes)
-        }
-    }
-}
-
-
-// MARK: UpdatableCryptor
-extension Rabbit: UpdatableCryptor {
-
-    public func makeEncryptor() -> Rabbit.Encryptor {
-        return Encryptor(rabbit: self)
-    }
-
-    public func makeDecryptor() -> Rabbit.Decryptor {
-        return Decryptor(rabbit: self)
-    }
-}
-
 // MARK: Cipher
 extension Rabbit: Cipher {
     public func encrypt(bytes: [UInt8]) -> [UInt8] {