Răsfoiți Sursa

Lipstick, update array styling

Marcin Krzyżanowski 8 ani în urmă
părinte
comite
2058827efa

+ 1 - 1
Sources/CryptoSwift/Checksum.swift

@@ -51,7 +51,7 @@ public final class Checksum {
         0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
         0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
     ]
     ]
 
 
-    private static let table16: [UInt16] = [
+    private static let table16: Array<UInt16> = [
         0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241,
         0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241,
         0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440,
         0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440,
         0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40,
         0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40,

+ 1 - 1
Sources/CryptoSwift/MD5.swift

@@ -154,7 +154,7 @@ extension MD5: Updatable {
 
 
         for hElement in accumulatedHash {
         for hElement in accumulatedHash {
             let hLE = hElement.littleEndian
             let hLE = hElement.littleEndian
-            result += [UInt8(hLE & 0xff), UInt8((hLE >> 8) & 0xff), UInt8((hLE >> 16) & 0xff), UInt8((hLE >> 24) & 0xff)]
+            result += Array<UInt8>(arrayLiteral: UInt8(hLE & 0xff), UInt8((hLE >> 8) & 0xff), UInt8((hLE >> 16) & 0xff), UInt8((hLE >> 24) & 0xff))
         }
         }
 
 
         // reset hash value for instance
         // reset hash value for instance

+ 2 - 2
Sources/CryptoSwift/PKCS7.swift

@@ -33,12 +33,12 @@ public struct PKCS7: Padding {
         if padding == 0 {
         if padding == 0 {
             // If the original data is a multiple of N bytes, then an extra block of bytes with value N is added.
             // If the original data is a multiple of N bytes, then an extra block of bytes with value N is added.
             for _ in 0..<blockSize {
             for _ in 0..<blockSize {
-                withPadding += [UInt8(blockSize)]
+                withPadding += Array<UInt8>(arrayLiteral:UInt8(blockSize))
             }
             }
         } else {
         } else {
             // The value of each added byte is the number of bytes that are added
             // The value of each added byte is the number of bytes that are added
             for _ in 0..<padding {
             for _ in 0..<padding {
-                withPadding += [UInt8(padding)]
+                withPadding += Array<UInt8>(arrayLiteral:UInt8(padding))
             }
             }
         }
         }
         return withPadding
         return withPadding

+ 1 - 1
Sources/CryptoSwift/Rabbit.swift

@@ -166,7 +166,7 @@ public final class Rabbit: BlockCipher {
     fileprivate func nextOutput() -> Array<UInt8> {
     fileprivate func nextOutput() -> Array<UInt8> {
         nextState()
         nextState()
 
 
-        var output16 = [UInt16](repeating: 0, count: Rabbit.blockSize / 2)
+        var output16 = Array<UInt16>(repeating: 0, count: Rabbit.blockSize / 2)
         output16[7] = UInt16(truncatingIfNeeded: x[0]) ^ UInt16(truncatingIfNeeded: x[5] >> 16)
         output16[7] = UInt16(truncatingIfNeeded: x[0]) ^ UInt16(truncatingIfNeeded: x[5] >> 16)
         output16[6] = UInt16(truncatingIfNeeded: x[0] >> 16) ^ UInt16(truncatingIfNeeded: x[3])
         output16[6] = UInt16(truncatingIfNeeded: x[0] >> 16) ^ UInt16(truncatingIfNeeded: x[3])
         output16[5] = UInt16(truncatingIfNeeded: x[2]) ^ UInt16(truncatingIfNeeded: x[7] >> 16)
         output16[5] = UInt16(truncatingIfNeeded: x[2]) ^ UInt16(truncatingIfNeeded: x[7] >> 16)

+ 3 - 3
Tests/CryptoSwiftTests/Poly1305Tests.swift

@@ -25,9 +25,9 @@ final class Poly1305Tests: XCTestCase {
 
 
     // https://github.com/krzyzanowskim/CryptoSwift/issues/183
     // https://github.com/krzyzanowskim/CryptoSwift/issues/183
     func testIssue183() {
     func testIssue183() {
-        let key: [UInt8] = [111, 53, 197, 181, 1, 92, 67, 199, 37, 92, 76, 167, 12, 35, 75, 226, 198, 34, 107, 84, 79, 6, 231, 10, 25, 221, 14, 155, 81, 244, 15, 203]
-        let message: [UInt8] = [208, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 162, 210, 40, 78, 3, 161, 87, 187, 96, 253, 104, 187, 87, 87, 249, 56, 5, 156, 122, 121, 196, 192, 254, 58, 98, 22, 47, 151, 205, 201, 108, 143, 197, 99, 182, 109, 59, 63, 172, 111, 120, 185, 175, 129, 59, 126, 68, 140, 237, 126, 175, 49, 224, 249, 245, 37, 75, 252, 69, 215, 171, 27, 163, 16, 185, 239, 184, 144, 37, 131, 242, 12, 90, 134, 24, 237, 209, 127, 71, 86, 122, 173, 238, 73, 186, 58, 102, 112, 90, 217, 243, 251, 110, 85, 106, 18, 172, 167, 179, 173, 73, 125, 9, 129, 132, 80, 70, 4, 254, 178, 211, 200, 207, 231, 232, 17, 176, 127, 153, 120, 71, 164, 139, 56, 106, 71, 96, 79, 11, 213, 243, 66, 53, 167, 108, 233, 250, 136, 69, 190, 191, 12, 136, 24, 157, 202, 49, 158, 152, 150, 34, 88, 132, 112, 74, 168, 153, 116, 31, 7, 61, 60, 22, 199, 108, 187, 209, 114, 234, 185, 247, 41, 68, 184, 95, 169, 60, 126, 73, 59, 54, 126, 162, 90, 18, 32, 230, 123, 2, 40, 74, 177, 127, 219, 93, 186, 22, 75, 251, 101, 95, 160, 68, 235, 77, 2, 10, 202, 2, 0, 0, 0, 0, 0, 0, 0, 208, 0, 0, 0, 0, 0, 0, 0]
-        let expectedMac: [UInt8] = [68, 216, 92, 163, 164, 144, 55, 43, 185, 18, 83, 92, 41, 133, 72, 168]
+        let key: Array<UInt8> = [111, 53, 197, 181, 1, 92, 67, 199, 37, 92, 76, 167, 12, 35, 75, 226, 198, 34, 107, 84, 79, 6, 231, 10, 25, 221, 14, 155, 81, 244, 15, 203]
+        let message: Array<UInt8> = [208, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 162, 210, 40, 78, 3, 161, 87, 187, 96, 253, 104, 187, 87, 87, 249, 56, 5, 156, 122, 121, 196, 192, 254, 58, 98, 22, 47, 151, 205, 201, 108, 143, 197, 99, 182, 109, 59, 63, 172, 111, 120, 185, 175, 129, 59, 126, 68, 140, 237, 126, 175, 49, 224, 249, 245, 37, 75, 252, 69, 215, 171, 27, 163, 16, 185, 239, 184, 144, 37, 131, 242, 12, 90, 134, 24, 237, 209, 127, 71, 86, 122, 173, 238, 73, 186, 58, 102, 112, 90, 217, 243, 251, 110, 85, 106, 18, 172, 167, 179, 173, 73, 125, 9, 129, 132, 80, 70, 4, 254, 178, 211, 200, 207, 231, 232, 17, 176, 127, 153, 120, 71, 164, 139, 56, 106, 71, 96, 79, 11, 213, 243, 66, 53, 167, 108, 233, 250, 136, 69, 190, 191, 12, 136, 24, 157, 202, 49, 158, 152, 150, 34, 88, 132, 112, 74, 168, 153, 116, 31, 7, 61, 60, 22, 199, 108, 187, 209, 114, 234, 185, 247, 41, 68, 184, 95, 169, 60, 126, 73, 59, 54, 126, 162, 90, 18, 32, 230, 123, 2, 40, 74, 177, 127, 219, 93, 186, 22, 75, 251, 101, 95, 160, 68, 235, 77, 2, 10, 202, 2, 0, 0, 0, 0, 0, 0, 0, 208, 0, 0, 0, 0, 0, 0, 0]
+        let expectedMac: Array<UInt8> = [68, 216, 92, 163, 164, 144, 55, 43, 185, 18, 83, 92, 41, 133, 72, 168]
         XCTAssertEqual(try message.authenticate(with: Poly1305(key: key)), expectedMac)
         XCTAssertEqual(try message.authenticate(with: Poly1305(key: key)), expectedMac)
     }
     }