Key derivation

From zakirkun/ice-tea · View interactive version

Key derivation is an AI agent skill from the GitHub repository zakirkun/ice-tea. Detects passwords used directly as encryption keys or hashed with fast algorithms instead of proper KDFs (PBKDF2, bcrypt, Argon2, scrypt).

How to use this skill

Skill file

Insecure Key Derivation

Overview

Passwords must not be used directly as cryptographic keys or passed through fast hash functions. Proper Key Derivation Functions (KDFs) intentionally add computational cost and mandatory salting:

Remediation

Always derive keys from passwords using a KDF with a random salt.

Vulnerable:

key = hashlib.sha256(password.encode()).digest()
cipher = AES.new(key, AES.MODE_GCM)

Safe:

import os
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.primitives import hashes
salt = os.urandom(16)
kdf = PBKDF2HMAC(algorithm=hashes.SHA256(), length=32, salt=salt, iterations=600000)
key = kdf.derive(password.encode())
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.