MySQLPacketAuthSwitchResponse.createWithCachingSha2Password constructor
MySQLPacketAuthSwitchResponse.createWithCachingSha2Password({})
Implementation
factory MySQLPacketAuthSwitchResponse.createWithCachingSha2Password({
required String password,
required Uint8List challenge,
}) {
if (password.isEmpty) {
return MySQLPacketAuthSwitchResponse(authData: Uint8List(0));
}
final passwordBytes = utf8.encode(password);
return MySQLPacketAuthSwitchResponse(
authData: xor(
sha256(passwordBytes),
sha256(sha256(sha256(passwordBytes)) + challenge),
),
);
}