Browse Source

For digest the intermediate result is optional

Marcin Krzyżanowski 7 years ago
parent
commit
ed4c74352b

+ 3 - 2
CryptoSwift.xcodeproj/xcshareddata/xcschemes/CryptoSwift.xcscheme

@@ -41,9 +41,10 @@
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       disableMainThreadChecker = "YES"
+      language = ""
       systemAttachmentLifetime = "keepNever"
-      codeCoverageEnabled = "YES"
-      shouldUseLaunchSchemeArgsEnv = "YES">
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      codeCoverageEnabled = "YES">
       <Testables>
          <TestableReference
             skipped = "NO">

+ 1 - 0
Sources/CryptoSwift/SHA1.swift

@@ -105,6 +105,7 @@ public final class SHA1: DigestType {
 
 extension SHA1: Updatable {
 
+    @discardableResult
     public func update(withBytes bytes: ArraySlice<UInt8>, isLast: Bool = false) throws -> Array<UInt8> {
         accumulated += bytes
 

+ 4 - 0
Sources/CryptoSwift/Updatable.swift

@@ -53,10 +53,12 @@ extension Updatable {
         }
     }
 
+    @discardableResult
     public mutating func finish(withBytes bytes: ArraySlice<UInt8>) throws -> Array<UInt8> {
         return try update(withBytes: bytes, isLast: true)
     }
 
+    @discardableResult
     public mutating func finish() throws -> Array<UInt8> {
         return try update(withBytes: [], isLast: true)
     }
@@ -75,6 +77,7 @@ extension Updatable {
 
 extension Updatable {
 
+    @discardableResult
     public mutating func update(withBytes bytes: Array<UInt8>, isLast: Bool = false) throws -> Array<UInt8> {
         return try update(withBytes: bytes.slice, isLast: isLast)
     }
@@ -83,6 +86,7 @@ extension Updatable {
         return try update(withBytes: bytes.slice, isLast: isLast, output: output)
     }
 
+    @discardableResult
     public mutating func finish(withBytes bytes: Array<UInt8>) throws -> Array<UInt8> {
         return try finish(withBytes: bytes.slice)
     }