{
  "id": "03",
  "content": [
    {
      "type": "heading",
      "text": "Modern Hashing: bcrypt & Argon2"
    },
    {
      "type": "text",
      "html": "<pre><code class='language-php'>// Argon2id\n$options=[ 'memory_cost'=>1<<17, 'time_cost'=>3, 'threads'=>2 ];\n$hash=password_hash($pwd, PASSWORD_ARGON2ID, $options);\n</code></pre>"
    },
    {
      "type": "text",
      "html": "<pre><code class='language-php'>// bcrypt\n$options=['cost'=>12];\n$hash=password_hash($pwd, PASSWORD_BCRYPT, $options);\n</code></pre>"
    },
    {
      "type": "text",
      "html": "<pre><code>// Node.js (bcrypt)\nconst bcrypt=require('bcrypt');\nconst hash=await bcrypt.hash(pwd,12);\n</code></pre>"
    },
    {
      "type": "text",
      "html": "<pre><code># Python (argon2-cffi)\nfrom argon2 import PasswordHasher\nph=PasswordHasher(time_cost=3, memory_cost=131072, parallelism=2)\nh=ph.hash(pwd)\n</code></pre>"
    }
  ],
  "quiz": {
    "questions": [
      {
        "id": "q1",
        "type": "single",
        "text": "Argon2id is preferred because it is:",
        "options": [
          {
            "id": "a",
            "text": "Memory-hard"
          },
          {
            "id": "b",
            "text": "Lossless"
          },
          {
            "id": "c",
            "text": "Fast like MD5"
          }
        ],
        "correct": [
          "a"
        ]
      },
      {
        "id": "q2",
        "type": "single",
        "text": "Target verification time per hash:",
        "options": [
          {
            "id": "a",
            "text": "~100\u2013250ms"
          },
          {
            "id": "b",
            "text": "1ms"
          },
          {
            "id": "c",
            "text": "10s"
          }
        ],
        "correct": [
          "a"
        ]
      }
    ]
  }
}