You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: secret.rs
    path of file: ./repos/mail-server/crates/directory/src/core
    
    the code of the file until where you have to start completion: /*
 * Copyright (c) 2023 Stalwart Labs Ltd.
 *
 * This file is part of Stalwart Mail Server.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPO
    
async fn verify_secret_hash(hashed_secret: &str, secret: &str) -> bool {
    if hashed_secret.starts_with('$') {
        verify_hash_prefix(hashed_secret, secret).await
    } else if hashed_secret.starts_with('_') {
        // Enhanced DES-based hash
        bsdi_crypt::verify(secret, hashed_secret)
    } else if let Some(hashed_secret) = hashed_secret.strip_prefix('{') {
        if let Some((algo, hashed_secret)) = hashed_secret.split_once('}') {
            match algo {
                "ARGON2" | "ARGON2I" | "ARGON2ID" | "PBKDF2" => {
                    verify_hash_prefix(hashed_secret, secret).await
                }
                "SHA" => {
                    // SHA-1
                    let mut hasher = Sha1::new();
                    hasher.update(secret.as_bytes());
                    String::from_utf8(base64_encode(&hasher.finalize()[..]).unwrap_or_default())
                        .unwrap()
                        == hashed_secret
                }
                "SSHA" => {
                    // Salted SHA-1
                    let decoded = base64_decode(hashed_secret.as_bytes()).unwrap_or_default();
                    let hash = decoded.get(..20).unwrap_or_default();
                    let salt = decoded.get(20..).unwrap_or_default();
                    let mut hasher = Sha1::new();
                    hasher.update(secret.as_bytes());
                    hasher.update(salt);
                    &hasher.finalize()[..] == hash
                }
                "SHA256" => {
                    // Verify hash
                    let mut hasher = Sha256::new();
                    hasher.update(secret.as_bytes());
                    String::from_utf8(base64_encode(&hasher.finalize()[..]).unwrap_or_default())
                        .unwrap()
                        == hashed_secret
                }
                "SSHA256" => {
                    // Salted SHA-256
                    let decoded = base64_decode(hashed_secret.as_bytes()).unwrap_or_default();
                    let hash = decoded.get(..32).unwrap_or_default();
                    let salt = decoded.get(32..).unwrap_or_default();
                    let mut hasher = Sha256::new();
                    hasher.update(secret.as_bytes());
                    hasher.update(salt);
                    &hasher.finalize()[..] == hash
                }
                "SHA512" => {
                    // SHA-512
                    let mut hasher = Sha512::new();
                    hasher.update(secret.as_bytes());
                    String::from_utf8(base64_encode(&hasher.finalize()[..]).unwrap_or_default())
                        .unwrap()
                        == hashed_secret
                }
                "SSHA512" => {
                    // Salted SHA-512
                    let decoded = base64_decode(hashed_secret.as_bytes()).unwrap_or_default();
                    let hash = decoded.get(..64).unwrap_or_default();
                    let salt = decoded.get(64..).unwrap_or_default();
                    let mut hasher = Sha512::new();
                    hasher.update(secret.as_bytes());
                    hasher.update(salt);
                    &hasher.finalize()[..] == hash
                }
                "MD5" => {
                    // MD5
                    let digest = md5::compute(secret.as_bytes());
                    String::from_utf8(base64_encode(&digest[..]).unwrap_or_default()).unwrap()
                        == hashed_secret
                }
                "CRYPT" | "crypt" => {
                    if hashed_secret.starts_with('$') {
                        verify_hash_prefix(hashed_secret, secret).await
                    } else {
                        // Unix crypt
                        unix_crypt::verify(secret, hashed_secret)
                    }
                }
                "PLAIN" | "plain" | "CLEAR" | "clear" => hashed_secret == secret,
                _ => {
                    tracing::warn!(
                        context = "directory",
                        event = "error",
                        algorithm = algo,
                        "Unsupported password hash algorithm"
                    );
                    false
                }
            }
        } else {
            tracing::warn!(
                context = "directory",
                event = "error",
                hash = hashed_secret,
                "Invalid password hash"
            );
            false
        }
    } else {
        hashed_secret == secret
    }
}