存储PBKDF2加密密码时要使用什么数据类型? [英] What data type to use when storing PBKDF2 encrypted passwords?

查看:192
本文介绍了存储PBKDF2加密密码时要使用什么数据类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用SimpleCrypto.Net加密我的密码,我理解使用PBKDF2和指定的盐和迭代次数。我想知道在数据库中设置密码列最合适的数据类型是什么。

I am using SimpleCrypto.Net to encrypt my passwords, which i understands uses PBKDF2 and a specified salt and number of iterations. I would like to know what's the most appropriate data type for me to set the password column to in the database.

推荐答案

在代码处,结果是64字节的base64编码密钥。考虑到base64由ASCII字符组成,我建议将其存储为 CHAR(88)或者在安全的一边,你可以用 VARCHAR MAX)。然而,由于密钥大小固定为64字节,结果的长度不应该改变(即使你的salt / iterations改变了)。

From looking at the code the result is a base64 encoded key of 64 bytes. Considering base64 is made up of ASCII characters I would recommend storing it as CHAR(88) or to be on the safe side you could go with VARCHAR(MAX). However, as the key size is fixed at 64 bytes the length of the result should never change (even if your salt/iterations are changed).

这篇关于存储PBKDF2加密密码时要使用什么数据类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆