Avatar CS Knowledge Wiki

KDF: Deriving Key from Password

原文链接:https://www.yuque.com/yangguangfanxing/zuyi8o/uhihuhs0xzp3ofu5

原文链接:https://www.yuque.com/yangguangfanxing/zuyi8o/uhihuhs0xzp3ofu5 ↗

Now let’s explain in details how to securely derive a key from a password and the most popular key derivation functions (KDFs) used in practice: PBKDF2 ↗, Bcrypt ↗, Scrypt ↗ and Argon2 ↗.

[TODO: explain the Linux crypt: SHA-512 key derivation]

We shall discuss the strong and weak sides of the above mentioned KDFs and when to use them.

Key Derivation Functions - Concepts#

In cryptography we often use passwords instead of binary keys, because passwords are easier to remember, to write down and can be shorter.

When a certain algorithm needs a key (e.g. for encryption or for digital signing) a key derivation function (password -> key) is needed.

We already noted that using SHA-256(password) as key-derivation is insecure! It is vulnerable to many attacks: brute-forcing, dictionary attacks, rainbow attacks and others, which may reverse the hash in practice and attacker can obtain the password.

Cryptographic Key Derivation Functions#

PBKDF2 ↗, Bcrypt ↗, Scrypt ↗ and Argon2 ↗ are significantly stronger key derivation functions and are designed to survive password guessing (brute force) attacks.

By design secure key derivation functions use salt (random number, which is different for each key derivation) + many iterations (to speed-down eventual password guessing process). This is a process, known as key stretching ↗.

To calculate a secure KDF it takes some CPU time to derive the key (e.g. 0.2 sec) + some memory (RAM). Thus deriving the key is “computationally expensive”, so password cracking will also be computationally expensive.

When a modern KDF function is used with appropriate config parameters, cracking passwords will be slow (e.g. 5-10 attempts per second, instead of thousands or millions attempts per second).

All of the above mentioned key-derivation algorithms (PBKDF2 ↗, Bcrypt ↗, Scrypt ↗ and Argon2 ↗) are not patented and royalty-free for public use.

Let’s learn more about these modern KDF.

Knowledge map

知识图谱

当前文档、同目录指南与引用关系。

准备中 全局图谱

正在构建知识图谱...

拖动节点 · 滚动缩放 · 点击打开

帮助与支持

这篇文档有帮助吗?

请给我们反馈以改进文档质量
(点击按钮后会打开邮箱)

帮助改进文档

所有文档均开源,发现问题或不清楚的地方?提交 PR 来帮助改进。

编辑此页面 了解如何贡献 →

需要更多帮助?

加入社区或直接联系获取支持

文件管理器 /
位置 /
内容
Knowledge explorer

知识图谱

全部知识 准备图谱...
文章 文档 标签 分类

正在加载知识网络...

拖动节点 · 滚动缩放 · 单击查看详情 · 双击打开页面
标签云 / Tag Cloud