JNCrypto and rncryto-js not return the same for RNCryptor.KeyForPassword() methode

39 views
Skip to first unread message

Trunk B

unread,
Aug 25, 2015, 10:26:03 AM8/25/15
to rncryptor
HI all , 
I tried to call the RNCryptor.KeyForPassword for both JNCrypto and rncryto-js whith the same input , but result return is not the same. EX as result after call RNCryptor.KeyForPassword , JNCrypto return me an array with 32 elements each element is a number which not bigger than 128, and rncryto-js return a array with 8 elements and each element is a number which number's count =10. 
JNCrypto :[xxxxxxxxx, xxxxxxxxxx, -xxxxxxxxxx, -xxxxxxxxxx, -xxxxxxxxx, -xxxxxxxxxx, xxxxxxxxxx, -xxxxxxxxx]
rncrypto-js :[-xx, -x, -xx, xx, -xx, -xx, xxx, -xx, -xxx, -xx, xx, -xx, -xx, -xx, -xxx, xxx, -xx, -xx, -x, -xx, -xx, -xx, -xxx, -xx, xx, xx, xx, xxx, xxx, xx, -xxx -xxx]
I think that in rncrypto.js ---->  RNCryptor.KeyForPassword -----> sjcl.misc.pbkdf2(password, salt, 10000, 32 * 8, hmacSHA1) may be i should but another option ? 
Regards,
Trunk



Rob Napier

unread,
Aug 25, 2015, 10:30:42 AM8/25/15
to rncr...@googlegroups.com
The JS version only uses 1000 iterations of PBKDF2 because JavaScript is generally too slow to handle the 10k that Java (and all other impls) use. You need to modify JS or JNCryptor to match in order to let them interoperate. It looks like you may be doing that already.

The difference is output format is just that, a difference in formatting. A key is a series of 32 bytes. You can interpret those as 32 8-bit integers or 8 32-bit integers or lots of other ways. You need to compare the underlying bytes.

-Rob

--
You received this message because you are subscribed to the Google Groups "rncryptor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rncryptor+...@googlegroups.com.
Visit this group at http://groups.google.com/group/rncryptor.
For more options, visit https://groups.google.com/d/optout.



--
Rob Napier
Cocoaphony blog -- http://robnapier.net/blog
iOS Programming Pushing the Limits -- http://robnapier.net/book
Reply all
Reply to author
Forward
0 new messages