运行以下代码:
import Crypto.BCrypt
import Data.ByteString.Lazy.Char8
main = do
maybe_pwhash <- hashPasswordUsingPolicy slowerBcryptHashingPolicy (pack "hunter2")
print $ maybe_pwhash我得到以下编译错误:
test.hs:5:70:
Couldn't match expected type `Data.ByteString.Internal.ByteString'
with actual type `ByteString'
In the return type of a call of `pack'
In the second argument of `hashPasswordUsingPolicy', namely
`(C.pack "hunter2")'
In a stmt of a 'do' block:
maybe_pwhash <- hashPasswordUsingPolicy
slowerBcryptHashingPolicy (pack "hunter2")我很困惑,因为我不明白为什么Data.ByteString.Internal.ByteString和ByteString之间有区别。
发布于 2013-12-23 04:47:55
根据bcrypt docs,您应该使用严格的字节字符串
import Data.ByteString.Char8而不是懒惰的人:
import Data.ByteString.Lazy.Char8https://stackoverflow.com/questions/20733924
复制相似问题