To create a hash in one line you can do one of the following.
#+BEGIN_SRC javascript
const hash1 = new Kana(Kana.ALGO_DEFAULT, new Salt("salt~")).once("input string~"); //Allocates the exact space required for the output string.
const hash2 = Kana.single(Kana.ALGO_DEFAULT, new Salt("salt~")).once("input string~"); //Allocates the max space required for the output string, instead of the exact. Might be faster.
#+END_SRC
*** Interface documentation
*** Interface documentation
The 2 exported objects are ~Kana~ and ~Salt~.
The 2 exported objects are ~Kana~ and ~Salt~.
~Kana~'s constructor expects between 0 and 2 arguments.
~Kana~'s constructor expects between 0 and 2 arguments.
@ -194,6 +212,7 @@
+ The second is either an instance of ~Salt~ or empty, if empty ~Kana~ uses the default library salt.
+ The second is either an instance of ~Salt~ or empty, if empty ~Kana~ uses the default library salt.
~Salt~'s constructor expects 0 or 1 argument.
~Salt~'s constructor expects 0 or 1 argument.
+ Either a string to use as the specific salt or empty, if empty there is no salt.
+ Either a string to use as the specific salt or empty, if empty there is no salt.
~Kana~ also has a static function ~single(algo, salt, input)~ which automatically creates a context, computes the hash, frees the context, and then returns the computed hash as a JavaScript string.