@@ -326,21 +326,56 @@ function caml_blake2_final(ctx, hashlen) {
326326//Provides: caml_blake2_update
327327//Requires: blake2b
328328//Requires: caml_uint8_array_of_string
329- //Version: >= 5.2
329+ //Version: >= 5.2, < 5.3
330330function caml_blake2_update ( ctx , buf , ofs , len ) {
331331 var input = caml_uint8_array_of_string ( buf ) ;
332332 input = input . subarray ( ofs , ofs + len ) ;
333333 blake2b . Update ( ctx , input ) ;
334334 return 0 ;
335335}
336336
337+ //Provides: caml_blake2_update
338+ //Requires: blake2b
339+ //Requires: caml_uint8_array_of_bytes
340+ //Version: >= 5.3
341+ function caml_blake2_update ( ctx , buf , ofs , len ) {
342+ var input = caml_uint8_array_of_bytes ( buf ) ;
343+ input = input . subarray ( ofs , ofs + len ) ;
344+ blake2b . Update ( ctx , input ) ;
345+ return 0 ;
346+ }
347+
337348//Provides: caml_blake2_string
338349//Requires: caml_blake2_create
339350//Requires: caml_blake2_update
340351//Requires: caml_blake2_final
341- //Version: >= 5.2
352+ //Version: >= 5.2, < 5.3
342353function caml_blake2_string ( hashlen , key , buf , ofs , len ) {
343354 var ctx = caml_blake2_create ( hashlen , key ) ;
344355 caml_blake2_update ( ctx , buf , ofs , len ) ;
345356 return caml_blake2_final ( ctx , hashlen ) ;
346357}
358+
359+ //Provides: caml_blake2_string
360+ //Requires: caml_blake2_create
361+ //Requires: caml_blake2_update
362+ //Requires: caml_blake2_final
363+ //Requires: caml_bytes_of_string
364+ //Version: >= 5.3
365+ function caml_blake2_string ( hashlen , key , buf_str , ofs , len ) {
366+ var ctx = caml_blake2_create ( hashlen , key ) ;
367+ var buf = caml_bytes_of_string ( buf_str ) ;
368+ caml_blake2_update ( ctx , buf , ofs , len ) ;
369+ return caml_blake2_final ( ctx , hashlen ) ;
370+ }
371+
372+ //Provides: caml_blake2_bytes
373+ //Requires: caml_blake2_create
374+ //Requires: caml_blake2_update
375+ //Requires: caml_blake2_final
376+ //Version: >= 5.3
377+ function caml_blake2_bytes ( hashlen , key , buf , ofs , len ) {
378+ var ctx = caml_blake2_create ( hashlen , key ) ;
379+ caml_blake2_update ( ctx , buf , ofs , len ) ;
380+ return caml_blake2_final ( ctx , hashlen ) ;
381+ }
0 commit comments