Jelajahi Sumber

rename digestSize -> digestLength

Marcin Krzyżanowski 9 tahun lalu
induk
melakukan
e613ef9e6b

+ 6 - 6
Sources/CryptoSwift/HMAC.swift

@@ -16,18 +16,18 @@ final public class HMAC: Authenticator {
     public enum Variant {
         case sha1, sha256, sha384, sha512, md5
         
-        var digestSize:Int {
+        var digestLength:Int {
             switch (self) {
             case .sha1:
-                return SHA1.digestSize
+                return SHA1.digestLength
             case .sha256:
-                return SHA2.Variant.sha256.digestSize
+                return SHA2.Variant.sha256.digestLength
             case .sha384:
-                return SHA2.Variant.sha384.digestSize
+                return SHA2.Variant.sha384.digestLength
             case .sha512:
-                return SHA2.Variant.sha512.digestSize
+                return SHA2.Variant.sha512.digestLength
             case .md5:
-                return MD5.digestSize
+                return MD5.digestLength
             }
         }
 

+ 1 - 1
Sources/CryptoSwift/MD5.swift

@@ -8,7 +8,7 @@
 
 public class MD5: DigestType  {
     static let blockSize:Int = 64
-    static let digestSize:Int = 16 // 128 / 8
+    static let digestLength:Int = 16 // 128 / 8
     fileprivate static let hashInitialValue:Array<UInt32> = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]
 
     fileprivate var accumulated = Array<UInt8>()

+ 2 - 2
Sources/CryptoSwift/PKCS5/PBKDF1.swift

@@ -26,9 +26,9 @@ public extension PKCS5 {
             var size:Int {
                 switch (self) {
                 case .md5:
-                    return MD5.digestSize
+                    return MD5.digestLength
                 case .sha1:
-                    return SHA1.digestSize
+                    return SHA1.digestLength
                 }
             }
 

+ 2 - 2
Sources/CryptoSwift/PKCS5/PBKDF2.swift

@@ -44,9 +44,9 @@ public extension PKCS5 {
                 throw Error.invalidInput
             }
 
-            self.dkLen = keyLength ?? variant.digestSize
+            self.dkLen = keyLength ?? variant.digestLength
             let keyLengthFinal = Double(self.dkLen)
-            let hLen = Double(prf.variant.digestSize)
+            let hLen = Double(prf.variant.digestLength)
             if keyLengthFinal > (pow(2,32) - 1) * hLen {
                 throw Error.derivedKeyTooLong
             }

+ 1 - 1
Sources/CryptoSwift/SHA1.swift

@@ -7,7 +7,7 @@
 //
 
 final class SHA1: DigestType {
-    static let digestSize:Int = 20 // 160 / 8
+    static let digestLength:Int = 20 // 160 / 8
     private let message: Array<UInt8>
     
     init(_ message: Array<UInt8>) {

+ 5 - 2
Sources/CryptoSwift/SHA2.swift

@@ -12,7 +12,7 @@ final class SHA2: DigestType {
     let variant: Variant
     var size: Int { return variant.rawValue }
     var blockSize: Int { return variant.blockSize }
-    var digestSize: Int { return variant.digestSize }
+    var digestLength: Int { return variant.digestLength }
 
     fileprivate var accumulated = Array<UInt8>()
     fileprivate var accumulatedLength: Int = 0
@@ -32,7 +32,10 @@ final class SHA2: DigestType {
     enum Variant: RawRepresentable {
         case sha224, sha256, sha384, sha512
 
-        var digestSize:Int { return self.rawValue }
+        var digestLength:Int {
+            return self.rawValue
+        }
+
         var blockSize: Int {
             switch self {
             case .sha224, .sha256: