doubi9999 2017-06-08 11:40
浏览 318
已采纳

PHP - 无论如何在PHP中加密/解密哈希? [关闭]

I'm interested to encrypt/decrpyt hash in PHP.

But as I know hash can be encoding only with md5, sha1, sha256.

However, is it possible to make encrypt/decrpyt in PHP by another hash like ripemd160, haval256,5 or ripemd256?

Thank

  • 写回答

2条回答 默认 最新

  • dongren4758 2017-06-08 13:10
    关注

    Hashing algorithms are not encryption algorithms. Hashing algorithms have the following principles:

    • Specific input produces always the same output
    • The input cannot be resolved based on the output
    • Any change to input will produce different output

    Technically the last one is not true, because you have limited amount of possible outputs but basically unlimited amount of possible inputs. Therefore there will be other inputs that produces the same output, but for strong hashing algorithms finding those collisions takes VERY long time as @delboy1978uk explained.

    MD5 is an example of a weak hashing algorithm that you should not use for secure hashes. Collision attacks against MD5 are cheap. On the other hand hashing algorithms in SHA2 family can be considered secure (take SHA256 for example).

    Encryption algorithms require a key or multiple keys to allow you to do decryption on the cipher text.

    The short answer to your questions is no.

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

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵