microsoft / MSR-JavaScript-Crypto

Microsoft JavaScript Cryptography Library
Other
59 stars 34 forks source link

Parameters for deriveBits and PBKDF2 #19

Open dirkcuys opened 1 year ago

dirkcuys commented 1 year ago

The W3C standard specifies that Pbkdf2Params should have a hash attribute in the format:

hash: { name: "SHA-512" }

But looking at MDN it's specified to just take a string as the value of hash

{
   name: "PBKDF2",
   salt,
   iterations: 100000,
   hash: "SHA-256",
},

Unfortunately Node.js webcrypto also does this and that makes it difficult to use this library to get isomorphic encryption across browser, nodejs and react-native.

It would be possible to accommodate this inconsistency in the code. Would that be a change(PR) that would be considered?

ljoy913 commented 1 year ago

It should accept both forms, I'll fix this soon and get back to you. Thanks!