浏览代码

Adapt to new rules of Swift 1.2. thanks to markusl #26

Marcin Krzyżanowski 10 年之前
父节点
当前提交
0f9a8ab82d
共有 5 个文件被更改,包括 6 次插入6 次删除
  1. 1 1
      CryptoSwift/HMAC.swift
  2. 1 1
      CryptoSwift/MD5.swift
  3. 1 1
      CryptoSwift/SHA1.swift
  4. 2 2
      CryptoSwift/SHA2.swift
  5. 1 1
      CryptoSwift/UInt32Extension.swift

+ 1 - 1
CryptoSwift/HMAC.swift

@@ -29,7 +29,7 @@ public class HMAC {
         }
     }
     
-    let key:[UInt8]
+    var key:[UInt8]
     let variant:Variant
     
     class internal func authenticate(# key: NSData, message: NSData, variant:HMAC.Variant = .md5) -> NSData? {

+ 1 - 1
CryptoSwift/MD5.swift

@@ -112,7 +112,7 @@ class MD5 : CryptoSwift.HashBase {
             buf.appendBytes(&i, length: sizeofValue(i))
         })
         
-        return buf.copy() as NSData;
+        return buf.copy() as! NSData;
     }
 }
 

+ 1 - 1
CryptoSwift/SHA1.swift

@@ -97,6 +97,6 @@ class SHA1 : CryptoSwift.HashBase {
             buf.appendBytes(&i, length: sizeofValue(i))
         })
         
-        return buf.copy() as NSData;
+        return buf.copy() as! NSData;
     }    
 }

+ 2 - 2
CryptoSwift/SHA2.swift

@@ -155,7 +155,7 @@ class SHA2 : CryptoSwift.HashBase {
             buf.appendBytes(&i, length: sizeofValue(i))
         })
         
-        return buf.copy() as NSData;
+        return buf.copy() as! NSData;
     }
     
     func calculate64(variant: SHA2.variant) -> NSData {
@@ -239,6 +239,6 @@ class SHA2 : CryptoSwift.HashBase {
             buf.appendBytes(&i, length: sizeofValue(i))
         })
         
-        return buf.copy() as NSData;
+        return buf.copy() as! NSData;
     }
 }

+ 1 - 1
CryptoSwift/UInt32Extension.swift

@@ -14,7 +14,7 @@ extension UInt32 {
         return arrayOfBytes(self, length: totalBytes)
     }
 
-    public static func withBytes(bytes: Slice<Byte>) -> UInt32 {
+    public static func withBytes(bytes: Slice<UInt8>) -> UInt32 {
         return UInt32.withBytes(Array(bytes))
     }