duanhe6718 2015-05-28 08:47
浏览 68

使用MD2散列独特的字符串

I have a list of unique email addresses - a very simple question. If the email is unique will the output always be unique,

hash('md2', $email);
  • 写回答

3条回答

  • douzhuolong9886 2015-05-28 10:22
    关注

    Hash functions like MD2 are like the name suggests message digest algorithms they take an arbitrary length input and give a fixed length output. There are bound to exist collisions for unique inputs.

    You can use stronger hash functions like SHA-256 where a collision between two strings is highly unlikely compared to MD2. The birthday paradox applies here, so you shouldn't use MDx functions or anything shorter than 256-bit hash functions.

    I see you're hashing e-mail addresses. Depending on your system, this can be exploited with a collision. For example, some e-mail providers enable virtual addresses of the form "myname+1@domain.com", "myname+2@domain.com" and so on. An attacker might use that fact to find a collision with a known other e-mail address to get for example the password reset e-mail or something like that.

    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)