         let M: Data
         do {
             M = try client.processChallenge(salt: s, publicKey: B)
-        } catch {
-            return XCTFail("Client couldn't process challenge: \(error) -- \(debugInfo())", file: file, line: line)
+            additionalDebug += "\nclientM: \(M.hex)"
+        } catch {
+            return XCTFail("Client couldn't process challenge: \(error) -- \(debugInfo())\(additionalDebug)", file: file, line: line)
         }
 
         // Using M, the server verifies the proof and calculates a proof for the client

        file: StaticString = #file,
        line: UInt = #line)
    {
        // Because of an interoperability issue with the library `srptools`,
        // the keys and salt are predefined. When the issue has been resolved,
        // these should be randomly generated again.
        //-TODO: make tests random again after https://github.com/idlesign/srptools/issues/2 has been resolved

        let server: RemoteServer
        do {
            server = try RemoteServer(username: username,
                                      password: password,
                                      group: group,
                                      algorithm: algorithm,
                                      privateKey: try! Data(hex: "a6edb28a37955142e77bd767bf2f41e823904a9b37e5ef9538f7d804553a9f9b17b254e199c85747522dba571293d16d0a6a1e792d29fda0196e3c2ee4c72d37ae20d9521dfcc1395da6ceb2cb2dd5f86c40c66c61f68d1f6c000c0b6dc6043be720d12bd3fbb9ce2f775ef90fc4f9c0567cfcaabc4fc0d7459f5790114a2dfb"),
                                      salt: try! Data(hex: "5c90beb7c6976084"))
        } catch {
            return XCTFail("Could not start remote server: \(error)", file: file, line: line)
        }
        let client = Client(username: username,
                            password: password,
                            group: group,
                            algorithm: algorithm,
                            privateKey: try! Data(hex: "e8bf050e0184b5cd5207a56a432386a41b22017ad77a9259914271e226036ed9"))

        let debugInfo: () -> String = {
            return [
                "username: \(username)",
                "password: \(password)",
                "group: \(group)",

        let M: Data
        do {
            M = try client.processChallenge(salt: s, publicKey: B)
            additionalDebug += "\nclientM: \(M.hex)"
        } catch {
            return XCTFail("Client couldn't process challenge: \(error) -- \(debugInfo())", file: file, line: line)
        }

        // Using M, the server verifies the proof and calculates a proof for the client
