Pārlūkot izejas kodu

Merge pull request #62 from MaddTheSane/finalClasses

Final classes
Marcin Krzyzanowski 10 gadi atpakaļ
vecāks
revīzija
95a048c476

+ 1 - 1
CryptoSwift/AES.swift

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

+ 1 - 1
CryptoSwift/CRC.swift

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

+ 2 - 2
CryptoSwift/ChaCha20.swift

@@ -8,13 +8,13 @@
 
 
 import Foundation
 import Foundation
 
 
-public class ChaCha20 {
+final public class ChaCha20 {
     
     
     static let blockSize = 64 // 512 / 8
     static let blockSize = 64 // 512 / 8
     private let stateSize = 16
     private let stateSize = 16
     private var context:Context?
     private var context:Context?
     
     
-    private class Context {
+    final private class Context {
         var input:[UInt32] = [UInt32](count: 16, repeatedValue: 0)
         var input:[UInt32] = [UInt32](count: 16, repeatedValue: 0)
         
         
         deinit {
         deinit {

+ 1 - 1
CryptoSwift/HMAC.swift

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

+ 1 - 1
CryptoSwift/MD5.swift

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

+ 1 - 1
CryptoSwift/Poly1305.swift

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

+ 1 - 1
CryptoSwift/SHA1.swift

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

+ 1 - 1
CryptoSwift/SHA2.swift

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

+ 1 - 1
CryptoSwiftTests/AESTests.swift

@@ -10,7 +10,7 @@ import Foundation
 import XCTest
 import XCTest
 import CryptoSwift
 import CryptoSwift
 
 
-class AESTests: XCTestCase {
+final class AESTests: XCTestCase {
     // 128 bit key
     // 128 bit key
     let aesKey:[UInt8] = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f]
     let aesKey:[UInt8] = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f]
 
 

+ 1 - 1
CryptoSwiftTests/ChaCha20Tests.swift

@@ -10,7 +10,7 @@ import Foundation
 import XCTest
 import XCTest
 import CryptoSwift
 import CryptoSwift
 
 
-class ChaCha20Tests: XCTestCase {
+final class ChaCha20Tests: XCTestCase {
 
 
     override func setUp() {
     override func setUp() {
         super.setUp()
         super.setUp()

+ 1 - 1
CryptoSwiftTests/ExtensionsTest.swift

@@ -10,7 +10,7 @@ import Foundation
 import XCTest
 import XCTest
 import CryptoSwift
 import CryptoSwift
 
 
-class ExtensionsTest: XCTestCase {
+final class ExtensionsTest: XCTestCase {
 
 
     override func setUp() {
     override func setUp() {
         super.setUp()
         super.setUp()

+ 1 - 1
CryptoSwiftTests/HMACTests.swift

@@ -10,7 +10,7 @@ import Foundation
 import XCTest
 import XCTest
 import CryptoSwift
 import CryptoSwift
 
 
-class HMACTests: XCTestCase {
+final class HMACTests: XCTestCase {
     
     
     override func setUp() {
     override func setUp() {
         super.setUp()
         super.setUp()

+ 1 - 1
CryptoSwiftTests/HashTests.swift

@@ -9,7 +9,7 @@
 import XCTest
 import XCTest
 import CryptoSwift
 import CryptoSwift
 
 
-class CryptoSwiftTests: XCTestCase {
+final class CryptoSwiftTests: XCTestCase {
     
     
     override func setUp() {
     override func setUp() {
         super.setUp()
         super.setUp()

+ 1 - 1
CryptoSwiftTests/PaddingTests.swift

@@ -10,7 +10,7 @@ import Foundation
 import XCTest
 import XCTest
 import CryptoSwift
 import CryptoSwift
 
 
-class PaddingTests: XCTestCase {
+final class PaddingTests: XCTestCase {
     func testPKCS7_0() {
     func testPKCS7_0() {
         let input:[UInt8]    = [1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6]
         let input:[UInt8]    = [1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6]
         let expected:[UInt8] = [1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]
         let expected:[UInt8] = [1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]

+ 1 - 1
CryptoSwiftTests/Poly1305Tests.swift

@@ -10,7 +10,7 @@ import Foundation
 import XCTest
 import XCTest
 import CryptoSwift
 import CryptoSwift
 
 
-class Poly1305Tests: XCTestCase {
+final class Poly1305Tests: XCTestCase {
     
     
     override func setUp() {
     override func setUp() {
         super.setUp()
         super.setUp()