File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -182,7 +182,21 @@ const salt = RNSimpleCrypto.utils.randomBytes(8);
182182const iterations = 4096 ;
183183const keyInBytes = 32 ;
184184const hash = " SHA1" ;
185- const passwordKey = await Pbkdf2 .hash (
185+ const passwordKey = await RNSimpleCrypto .PBKDF2 .hash (
186+ password,
187+ salt,
188+ iterations,
189+ keyInBytes,
190+ hash
191+ );
192+ console .log (" PBKDF2 passwordKey" , passwordKey);
193+
194+ const password = messageArrayBuffer;
195+ const salt = RNSimpleCrypto .utils .randomBytes (8 );
196+ const iterations = 10000 ;
197+ const keyInBytes = 32 ;
198+ const hash = " SHA256" ;
199+ const passwordKey = await RNSimpleCrypto .PBKDF2 .hash (
186200 password,
187201 salt,
188202 iterations,
Original file line number Diff line number Diff line change @@ -123,15 +123,15 @@ const PBKDF2 = {
123123 saltToHash = convertUtf8ToArrayBuffer ( salt ) ;
124124 }
125125
126- const hashHex = await NativeModules . Pbkdf2 . hash (
126+ const digest = await NativeModules . Pbkdf2 . hash (
127127 convertArrayBufferToBase64 ( passwordToHash ) ,
128128 convertArrayBufferToBase64 ( saltToHash ) ,
129129 iterations ,
130130 keyLength ,
131131 algorithm
132132 ) ;
133133
134- return convertBase64ToArrayBuffer ( hashHex ) ;
134+ return convertBase64ToArrayBuffer ( digest ) ;
135135 }
136136} ;
137137
You can’t perform that action at this time.
0 commit comments