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.
我正在尝试有两个字符串,例如asdfgand zxcv。当我以相反的顺序zxcv和asdfg. 可以给我提示从哪里开始吗?我正在使用nodejs,我知道有很多可以散列的包,但我不确定如何实现这种方式。
asdfg
zxcv
您可以使用 MD5,如果您使用相同的盐,它始终会生成对应于相同输入的相同结果。
喜欢这个:https ://www.npmjs.com/package/md5
只需对字符串进行排序,然后对它们进行哈希处理。使用您想要的任何散列方法,然后执行类似的操作hash(['zxcv', 'asdfg'].sort().join(''))
hash(['zxcv', 'asdfg'].sort().join(''))