Adding SSO after many users already signed up -- how to migrate them?

This is a built in function.

$hash = hash_pbkdf2('sha256', 'YourPassword', 'YourSalt', 64000, 64, false);

Typically hash algorithms operate on binary data and the result is hex- or Base64-encoded upon output. So that’s not an issue.