MediumPro challengeJavaScriptTypeScript
Weak Encryption Key — Reject Defaults and Short Keys
JavaScriptSecurityCryptographic Issues
The key-validation function below accepts any non-empty string as an encryption key.
The bug: applications regularly ship with a default/placeholder key like "secret" or "changeme" in a config template — and if that default is never actually changed in production, every encrypted value is trivially decryptable by anyone who knows the well-documented default.
Your task: fix solve(key) so it returns true only when the key is at least 16 characters long and is not one of the well-known weak/default values: 'secret', 'password', '12345', 'changeme', or an empty string (case-insensitive match).
Sample tests
Test #1Well-known weak default, also too short
Input: ["secret"]
Output: false
Test #2Long, non-default key accepted
Input: ["aaaaaaaaaaaaaaaa"]
Output: true
Test #3Too short, not a known default
Input: ["short"]
Output: false