Shared password detection

Write codeEasy15 min

Your task

A security review receives an export of stored login credentials, one row per line, written account|algorithm|salt|digest. Nothing is recomputed here: the rows are compared exactly as they arrive. Two different accounts share a password when their algorithm and salt match character for character and their digests match ignoring letter case, since the export tools disagree on hex casing. A row that does not hold exactly four fields, or that leaves any field empty, came from a broken export and is skipped. The same account can appear on several rows, and an account never counts as sharing with itself. Return the names of the accounts that share a credential with at least one other account, each name once, sorted in ascending order. Return an empty list when nothing is shared.

Examples

reused_credential_accounts(dump: list[str]) -> list[str]
Example 1
Inputreused_credential_accounts(["ann|argon2|s1|AB12", "bob|argon2|s1|ab12", "cid|argon2|s2|ab12"])
Output["ann", "bob"]
Example 2
Inputreused_credential_accounts(["ann|bcrypt|s1|ff", "bob|bcrypt|s1|FF", "cid|bcrypt|s1|Ff"])
Output["ann", "bob", "cid"]
Example 3
Inputreused_credential_accounts(["ann|bcrypt|s1|ff", "ann|bcrypt|s1|ff"])
Output[]