Passwords are most likely stored as md5. Method scram-sha-256 appeared only in 10 and 12 including the release is still not used by default (problems with the database no, the community gives time for the implementation of this Protocol in the client libraries to 8.0 with mysql as it turned out).
The password hashes md5 can be found in table pg_authid system catalog are considered as
select rolpassword = ('md5' || md5('some password' || rolname)) from pg_authid where rolname = 'username';
That is, to restore the original password is impossible. You can try to find a collision for the hash.