浏览代码

Mark classes as final.
This will make them be a little faster, but they can't be subclassed.
The HashBase class isn't final because there are subclasses.

C.W. Betts 10 年之前
父节点
当前提交
1be97e742b

+ 1 - 1
CryptoSwift/AES.swift

@@ -8,7 +8,7 @@
 
 import Foundation
 
-public class AES {
+final public class AES {
     
     public enum AESVariant:Int {
         case unknown, aes128, aes192, aes256

+ 1 - 1
CryptoSwift/CRC.swift

@@ -8,7 +8,7 @@
 
 import Foundation
 
-class CRC {
+final class CRC {
     
     private let table:[UInt32] = [0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
         0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,

+ 1 - 1
CryptoSwift/ChaCha20.swift

@@ -8,7 +8,7 @@
 
 import Foundation
 
-public class ChaCha20 {
+final public class ChaCha20 {
     
     static let blockSize = 64 // 512 / 8
     private let stateSize = 16

+ 1 - 1
CryptoSwift/HMAC.swift

@@ -8,7 +8,7 @@
 
 import Foundation
 
-public class HMAC {
+final public class HMAC {
     
     public enum Variant {
         case sha1, sha256, sha384, sha512, md5

+ 1 - 1
CryptoSwift/MD5.swift

@@ -8,7 +8,7 @@
 
 import Foundation
 
-class MD5 : CryptoSwift.HashBase, _Hash {
+final class MD5 : CryptoSwift.HashBase, _Hash {
     var size:Int = 16 // 128 / 8
     
     /** specifies the per-round shift amounts */

+ 1 - 1
CryptoSwift/Poly1305.swift

@@ -12,7 +12,7 @@
 
 import Foundation
 
-public class Poly1305 {
+final public class Poly1305 {
     let blockSize = 16
     private var ctx:Context?
     

+ 1 - 1
CryptoSwift/SHA1.swift

@@ -8,7 +8,7 @@
 
 import Foundation
 
-class SHA1 : CryptoSwift.HashBase, _Hash {
+final class SHA1 : CryptoSwift.HashBase, _Hash {
     var size:Int = 20 // 160 / 8
     
     override init(_ message: NSData) {

+ 1 - 1
CryptoSwift/SHA2.swift

@@ -9,7 +9,7 @@
 import Foundation
 
 
-class SHA2 : HashBase, _Hash {
+final class SHA2 : HashBase, _Hash {
     var size:Int { return variant.rawValue }
     let variant:SHA2.Variant