Pckdf2 hash mismatch with mosaic and couch

My problematic context: Fedora 22 64bit on Linode KVM instance, CouchDB v.1.6.1, SBCL 1.2.16

CouchDB: I am creating a user with a password "testpass". The corresponding created document in the database _userscontains (among other things):

{ ...
  "password_scheme": "pbkdf2",
   "iterations": 10,
   "name": "test",
   "roles": ["reader"],
   "type": "user",
   "derived_key": "7b0cad0d2762b448b88684332e68988e801195ad",
   "salt": "2e4bcf85f39279ab9d1e1336a00dce0e"
...}

So, in my lisp answer on the same machine, I do:

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>

Thus, the exit "ce55610fe10bc49703f0df95adb6c9c9c71e3f8e"from the iron handle does not match "7b0cad0d2762b448b88684332e68988e801195ad"from the sofa.

I tried all supported digests in an iron hand, but no luck. Does anyone have any ideas on what might be wrong?

+4
source share
1 answer

: CouchDB "2e4bcf85f39279ab9d1e1336a00dce0e" , hex-string-to-byte-array. , . :

(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">>
+6

Source: https://habr.com/ru/post/1612835/


All Articles