Par*_*ife 4 couchdb common-lisp ironclad pbkdf2
我的问题上下文:Linode KVM实例上的Fedora 22 64位,CouchDB v.1.6.1,SBCL 1.2.16
CouchDB:我用密码创建了一个用户"testpass"._users数据库中相应的创建文档包含(以及其他内容):
{ ...
"password_scheme": "pbkdf2",
"iterations": 10,
"name": "test",
"roles": ["reader"],
"type": "user",
"derived_key": "7b0cad0d2762b448b88684332e68988e801195ad",
"salt": "2e4bcf85f39279ab9d1e1336a00dce0e"
...}
Run Code Online (Sandbox Code Playgroud)
所以我在同一台机器上的lisp repl中做了:
REPL>(in-package :ironclad)
REPL>(byte-array-to-hex-string
(pbkdf2-hash-password
(ascii-string-to-byte-array "testpass")
:salt (hex-string-to-byte-array "2e4bcf85f39279ab9d1e1336a00dce0e")
:digest 'sha1
:iterations 10))
"ce55610fe10bc49703f0df95adb6c9c9c71e3f8e"
REPL>
Run Code Online (Sandbox Code Playgroud)
因此"ce55610fe10bc49703f0df95adb6c9c9c71e3f8e"铁甲的输出与"7b0cad0d2762b448b88684332e68988e801195ad"沙发不匹配.
我已经尝试了所有支持的摘要,但没有运气.有没有人对什么可能是错的有任何想法?
这很简单:CouchDB使用"2e4bcf85f39279ab9d1e1336a00dce0e"salt作为二进制字符串,而将其转换为字节数组hex-string-to-byte-array.Unhexing它给你不同的盐.这很容易检查:
(node1@127.0.0.1)1> couch_passwords:pbkdf2(<<"testpass">>, <<"2e4bcf85f39279ab9d1e1336a00dce0e">>, 10).
<<"7b0cad0d2762b448b88684332e68988e801195ad">>
(node1@127.0.0.1)2> couch_passwords:pbkdf2(<<"testpass">>, <<50,101,52,98,99,102,56,53,102,51,57,50,55,57,97,98,57,100,49,101,49,51,51,54,97,48,48,100,99,101,48,101>>, 10).
<<"7b0cad0d2762b448b88684332e68988e801195ad">>
(node1@127.0.0.1)3> couch_passwords:pbkdf2(<<"testpass">>, <<46,75,207,133,243,146,121,171,157,30,19,54,160,13,206,14>>, 10).
<<"ce55610fe10bc49703f0df95adb6c9c9c71e3f8e">>
Run Code Online (Sandbox Code Playgroud)