0
我使用buddy.hashers生成並保存「hashed_password」字段我的用戶的SQL表,但它會產生不同的字符串:buddy.hashers總是產生不同的散列
user=> (require '[buddy.hashers :as hashers])
nil
user=> (hashers/derive "password")"bcrypt+sha512$b55166651bb4e7241f1c42342bdc1ea6$12$8328fb1e4326dc920c6aff38076156da59594b264818c922"
user=> (hashers/derive "password" "bcrypt+sha512$cf25e31d3a64f4189a9141b8f5e11aed$12$4b07f8380378f3a885f2212cfbe0d4f0901e8971d416e41e"
user=> (hashers/derive "password")"bcrypt+sha512$3b569dc15a8d8e74b81a2e0652bf5172$12$b2bbf343ff7d94bccbadff07b2b9629eab3dde43c039106d"
user=> (hashers/derive "password")"bcrypt+sha512$8d4081381c95220d6b9b67eef041dd89$12$8337f9b53f6b0f32cf30c01708e2135f94c284f5e768cc66"
爲什麼呢?
UPDATE:
(hashers/derive "password" {:salt "1f1v45642bzz1ea6" })
重要的是,根據該鏈接不只是給後面的哈希密碼:它也給你,也選擇了鹽,你應該存儲在數據庫中,以便其他元數據以後能夠檢查哈希值。 – amalloy