support SHA256 and SHA512 hash algorithm for otpauth:// TOTPs, closes https://github.com/PhilippC/keepass2android/issues/1155

This commit is contained in:
Philipp Crocoll
2021-01-12 17:08:55 +01:00
parent 7df048263b
commit c46b7be051

View File

@@ -31,6 +31,11 @@ namespace keepass2android
res.Length = parsedQuery.Get("digits");
res.Duration = parsedQuery.Get("period");
res.Encoder = parsedQuery.Get("encoder");
string algo = parsedQuery.Get("algorithm");
if (algo == "SHA512")
res.HashAlgorithm = "HMAC-SHA-512";
if (algo == "SHA256")
res.HashAlgorithm = "HMAC-SHA-256";
//set defaults according to https://github.com/google/google-authenticator/wiki/Key-Uri-Format