doujuegai8830 2012-12-14 02:59
浏览 47
已采纳

使用varchar或Char对于加密的Salt?

It has always puzzled me with the creation of my Databases. What would be the correct data type for my Encrypted with md5 salt password?

I've been using VarChar; but i've been told to move over to char but never given an explination?

Which also, I know it's not in best practice but i've got my database as Varchar(255) to hold my password; What would also be the best length to have it? because I don't know for certain if md5 always returns the same length string, or it can vary?

  • 写回答

3条回答 默认 最新

  • duanlian1960 2012-12-14 03:05
    关注

    You're first question:

    VARCHAR

    • Trailing white space is preserved. (MySQL 5.0.3+ only.)
    • Minimal storage overhead. A 17 character record takes up only 17 characters of space.
    • Slower SELECTs when searching this column.

    CHAR

    • Trailing white space is always removed.
    • Every record takes up a fixed amount of space - 19 characters in your case. Your 17 character records will waste two bytes of storage.
    • Faster SELECTs when searching this column.

    Source

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 深度学习残差模块模型
  • ¥20 两个不同Subnet的点对点连接
  • ¥50 怎么判断同步时序逻辑电路和异步时序逻辑电路
  • ¥15 差动电流二次谐波的含量Matlab计算
  • ¥15 Can/caned 总线错误问题,错误显示控制器要发1,结果总线检测到0
  • ¥15 C#如何调用串口数据
  • ¥15 MATLAB与单片机串口通信
  • ¥15 L76k模块的GPS的使用
  • ¥15 请帮我看一看数电项目如何设计
  • ¥23 (标签-bug|关键词-密码错误加密)