summaryrefslogtreecommitdiffstats
path: root/test/scrypt_test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/scrypt_test.js')
-rw-r--r--test/scrypt_test.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/scrypt_test.js b/test/scrypt_test.js
new file mode 100644
index 0000000..c6aa15c
--- /dev/null
+++ b/test/scrypt_test.js
@@ -0,0 +1,23 @@
+new sjcl.test.TestCase("scrypt", function (cb) {
+ var self = this;
+ if (!sjcl.misc.scrypt) {
+ this.unimplemented();
+ cb && cb();
+ return;
+ }
+
+ sjcl.test.vector.scrypt.forEach(function (vect) {
+ var cand = sjcl.codec.hex.fromBits(sjcl.misc.scrypt(
+ vect["password"],
+ vect["salt"],
+ vect["N"],
+ vect["r"],
+ vect["p"],
+ vect["dkLen"] * 8
+ ));
+
+ self.require(vect["expected"] == cand);
+ });
+
+ cb && cb();
+});