@julian @Pitaj @gotwf
Thanks for your replies, it was useful and I'm making some progress here. Please stay with me a bit more so I can finish this, help's appreciated here very much
Right now I'm struggling with SHA512 hashing, here's the code that I took from password.js to do hashing:
passwordSHA512 = crypto.createHash('sha512').update(passwordSHA512).digest('hex');
console.log(passwordSHA512); // 4ffcc3cce9a56025aa0126c2fe7ec247e8a6e5ee6fdd5e854bb3761b66e5c5c4909189ad054e44a473cc29fd461fccf1965aebe5b17dfbaac9b994112c5a33a3
const salt = bcrypt.genSaltSync(12);
const hash = bcrypt.hashSync(passwordSHA512, salt);
console.log(salt); // $2a$12$ZDFzbDOVrZSZ.L.RFWQiqe
console.log(hash); // $2a$12$ZDFzbDOVrZSZ.L.RFWQiqej/ed5M6b/C06Hz/mRCuOd1fMVpzVF/.
So it's used in completely the same way as in password.js, but what I finally get is some other hash string, which is not the same as hash string generated by NodeBB which is saved in its database.
As I've previously said, the length of hash I get after SHA512 is applied looks suspicious to me, and it's 128 chars long hex value which I don't know how it's supposed to be supplied to bcrypt because of 72 chars limit. Probably that HEX value is somehow converted to shorter string? But if it's somehow automatic, it's supposed to work, but what I get is completely some other value than I need to get.