In 6 blocks (when the height ends in xxx006) we get its block hash (in hex) and apply the key-stretching
This is a little ambiguous. Do you include the "0x" prefix? Do you use uppercase or lowercase hex? Do you include leading zeroes?
I propose you specify that you will use the 64 lowercase characters given by getblockhash, for example:
$ bitcoin-cli getblockhash 383006
00000000000000000ef86b27c174df6a412c0ce43eab1d532034555749294137
Here's an example with a smaller iteration count using that block hash, to check we arrive at the same result:
> Buffer(forge.pbkdf2('00000000000000000ef86b27c174df6a412c0ce43eab1d532034555749294137', 'pevpot', 100000, 32, 'sha256'), 'binary').toString('hex')
'39aed3d2eff372916100106e355384495d1794320d4c3cb4c2e0e48cc36bbd06'
Or in Python:
$ python
Python 2.7.9 (default, Mar 1 2015, 12:57:24)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import hashlib, hmac, pbkdf2
>>> pbkdf2.PBKDF2('00000000000000000ef86b27c174df6a412c0ce43eab1d532034555749294137', 'pevpot', 100000, hashlib.sha256, hmac).hexread(32)
'39aed3d2eff372916100106e355384495d1794320d4c3cb4c2e0e48cc36bbd06'