Skip to content

Commit b27f3ab

Browse files
committed
update to latest crypto rc
1 parent 29977c5 commit b27f3ab

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Sources/MySQL/Connection/MySQLConnection+Authenticate.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ extension MySQLConnection {
3333
throw MySQLError(identifier: "salt", reason: "Server-supplied salt too short.", source: .capture())
3434
}
3535
let salt = Data(handshake.authPluginData[..<20])
36-
let passwordHash = SHA1.hash(password)
37-
let passwordDoubleHash = SHA1.hash(passwordHash)
38-
var hash = SHA1.hash(salt + passwordDoubleHash)
36+
let passwordHash = try SHA1.digest(password)
37+
let passwordDoubleHash = try SHA1.digest(passwordHash)
38+
var hash = try SHA1.digest(salt + passwordDoubleHash)
3939
for i in 0..<20 {
4040
hash[i] = hash[i] ^ passwordHash[i]
4141
}

Sources/MySQL/Connection/MySQLData.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ extension MySQLData: CustomStringConvertible {
282282
switch binary.type {
283283
case .MYSQL_TYPE_VARCHAR, .MYSQL_TYPE_VAR_STRING:
284284
return String(data: data, encoding: .utf8).flatMap { "string(\"\($0)\")" } ?? "<non-utf8 string (\(data.count))>"
285-
default: return "data(0x\(data.hexString))"
285+
default: return "data(0x\(data.hexEncodedString()))"
286286
}
287287
default: return "\(data)"
288288
}

0 commit comments

Comments
 (0)