Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for swordfish (0.19 sec)

  1. docs/zh/docs/advanced/security/http-basic-auth.md

    ```Python hl_lines="1  11-13"
    {!../../../docs_src/security/tutorial007.py!}
    ```
    
    这段代码确保 `credentials.username` 是 `"stanleyjobson"`,且 `credentials.password` 是`"swordfish"`。与以下代码类似:
    
    ```Python
    if not (credentials.username == "stanleyjobson") or not (credentials.password == "swordfish"):
        # Return some error
        ...
    ```
    
    但使用 `secrets.compare_digest()`,可以防御**时差攻击**,更加安全。
    
    ### 时差攻击
    
    什么是**时差攻击**?
    
    假设攻击者试图猜出用户名与密码。
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 22:43:48 GMT 2024
    - 3.9K bytes
    - Viewed (0)
  2. docs/de/docs/advanced/security/http-basic-auth.md

    Dann können wir `secrets.compare_digest()` verwenden, um sicherzustellen, dass `credentials.username` `"stanleyjobson"` und `credentials.password` `"swordfish"` ist.
    
    === "Python 3.9+"
    
        ```Python hl_lines="1  12-24"
        {!> ../../../docs_src/security/tutorial007_an_py39.py!}
        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="1  12-24"
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 20:28:08 GMT 2024
    - 6.9K bytes
    - Viewed (0)
  3. docs_src/security/tutorial007_an.py

        is_correct_username = secrets.compare_digest(
            current_username_bytes, correct_username_bytes
        )
        current_password_bytes = credentials.password.encode("utf8")
        correct_password_bytes = b"swordfish"
        is_correct_password = secrets.compare_digest(
            current_password_bytes, correct_password_bytes
        )
        if not (is_correct_username and is_correct_password):
            raise HTTPException(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 1.2K bytes
    - Viewed (0)
  4. docs_src/security/tutorial007.py

        is_correct_username = secrets.compare_digest(
            current_username_bytes, correct_username_bytes
        )
        current_password_bytes = credentials.password.encode("utf8")
        correct_password_bytes = b"swordfish"
        is_correct_password = secrets.compare_digest(
            current_password_bytes, correct_password_bytes
        )
        if not (is_correct_username and is_correct_password):
            raise HTTPException(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jan 11 14:33:05 GMT 2024
    - 1.1K bytes
    - Viewed (0)
  5. docs/em/docs/advanced/security/http-basic-auth.md

    ⤴️ 👥 💪 ⚙️ `secrets.compare_digest()` 🚚 👈 `credentials.username` `"stanleyjobson"`, & 👈 `credentials.password` `"swordfish"`.
    
    ```Python hl_lines="1  11-21"
    {!../../../docs_src/security/tutorial007.py!}
    ```
    
    👉 🔜 🎏:
    
    ```Python
    if not (credentials.username == "stanleyjobson") or not (credentials.password == "swordfish"):
        # Return some error
        ...
    ```
    
    ✋️ ⚙️ `secrets.compare_digest()` ⚫️ 🔜 🔐 🛡 🆎 👊 🤙 "🕰 👊".
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 4.1K bytes
    - Viewed (0)
  6. docs/en/docs/advanced/security/http-basic-auth.md

    Then we can use `secrets.compare_digest()` to ensure that `credentials.username` is `"stanleyjobson"`, and that `credentials.password` is `"swordfish"`.
    
    === "Python 3.9+"
    
        ```Python hl_lines="1  12-24"
        {!> ../../../docs_src/security/tutorial007_an_py39.py!}
        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="1  12-24"
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jan 11 14:33:05 GMT 2024
    - 5.9K bytes
    - Viewed (0)
  7. docs_src/security/tutorial007_an_py39.py

        is_correct_username = secrets.compare_digest(
            current_username_bytes, correct_username_bytes
        )
        current_password_bytes = credentials.password.encode("utf8")
        correct_password_bytes = b"swordfish"
        is_correct_password = secrets.compare_digest(
            current_password_bytes, correct_password_bytes
        )
        if not (is_correct_username and is_correct_password):
            raise HTTPException(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 1.1K bytes
    - Viewed (0)
Back to top