Files @ 07d399b4c31c
Branch filter:

Location: CryptoJS/spec/test/pbkdf2Spec.js

Laman
updated .hgignore
/* global expect */

describe("pbkdf2", function() {
	let cryptoJS = require("../../dist/main.js");
	let pbkdf2 = cryptoJS.pbkdf2;

	// it is difficult to find an independent implementation or an example of PBKDF2-BLAKE2s with no HMAC.
	// so we test against our own values to test at least against bugs introduced later
	it("should return a correct test key", function() {
		expect(pbkdf2([1, 2, 3], [4, 5, 6, 7, 8, 9, 10, 11], 1024, 32)).toEqual([2, 3, 212, 35, 227, 5, 152, 88, 48, 219, 42, 238, 177, 51, 111, 73, 233, 136, 19, 10, 10, 108, 89, 230, 77, 23, 104, 152, 86, 23, 255, 14]);

		let longPass = "1234567890=10=567890=20=567890=30=56".split("").map(c => c.charCodeAt(0));
		let salt = "1234567890_10_56".split("").map(c => c.charCodeAt(0));
		expect(pbkdf2(longPass, salt, 1337, 48)).toEqual([244, 203, 226, 107, 154, 99, 73, 33, 255, 175, 82, 97, 85, 137, 201, 104, 158, 129, 12, 200, 193, 48, 71, 149, 117, 184, 161, 189, 247, 120, 62, 9, 20, 30, 109, 140, 190, 224, 78, 217, 133, 51, 168, 25, 25, 52, 247, 40]);
	});

});