Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想为设备创建一个唯一的 id,所以我决定创建 SHA1(mac XOR timestamp XOR user_password)。是否存在与此相关的安全问题?做SHA1(mac CONCATENATE timestamp CONCATENATE user_password)会更好吗?
谢谢
使用连接 - 然后您将基于所有可用源数据的哈希值。
如果您使用 XOR,那么您的一部分源数据可能会在传递给散列函数之前“取消”剩余数据的部分(或全部)位。
并且连接而不是 XORing 不会影响存储散列所需的空间 - 无论源数据的大小如何,生成的 SHA1 散列将始终为 20 个字节。