doudouji2016 2013-02-14 22:08
浏览 34

欺骗黑客认为加密是md5是不是一个好/聪明的想法,当它不是?

$clear_text = "hello";
$salt_ = sha1("758hF4H7gJi98U6o");
$salt = substr($salt_, 0, 12);
$hash = substr(hash("sha512", $clear_text), 0, 20).$salt;

As you can see, $hash generates a 32 character string, making it look identical to md5. So a hacker will be trying to decrpyt this md5 hash when in fact it is nothing like that! Would this be cunning, and would it be a good idea?

  • 写回答

2条回答 默认 最新

  • doulu1544 2013-02-14 22:18
    关注

    Don't try to invent your own crypto, use standardized hashing algorithms like bcrypt, scrypt or PBKDF2.

    Please refer to:

    There is a principle in security which is called Kirckhoff's principle, one of the rules is "It must not be required to be secret, and it must be able to fall into the hands of the enemy without inconvenience" Suggest the attacker has access to your machine and is able to dump your source files as well as your database it won't take him very long to discover your algorithm.

    Now from there your own rolled algorithm doesn't really provide any additional protection from normal sha512+salt. The speed at which he would be able to attack the hashes would be the same with or without your algorithm. Meaning your scheme is useless once the algorithm as been found.

    评论

报告相同问题?

悬赏问题

  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算