diff options
author | Azul <azul@riseup.net> | 2013-10-14 11:43:34 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2013-10-14 11:52:44 +0200 |
commit | 4c8e593b7b03abb19b451b6be999f10e0fed5ff4 (patch) | |
tree | f4ae8de3d30267443b0a242887d8e583fdb174d1 /spec | |
parent | 948898fd93dd90031602a445cfc5dd432ddc7f39 (diff) |
properly treat utf8 chars in password
utf-8 encoding used to be bundled with the SHA256 library. However we
only want to utf8 encode strings that are actual user input. We do not
want to encode the bytearrays that are used when hashing the hex values
calculated during for SRP.
So I separated the utf-8 encoding and the sha256 hashing.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/calculate_spec.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/spec/calculate_spec.js b/spec/calculate_spec.js index be916c1..02bff1d 100644 --- a/spec/calculate_spec.js +++ b/spec/calculate_spec.js @@ -32,8 +32,21 @@ describe("Calculate", function() { }); it("calculates the right verifier", function() { - x = calculate.X(compare.username, compare.password, compare.salt) - expect(calculate.V(x)).toBe(compare.v); + calculate_and_compare_verifier(compare); }); - + + it("calculates the right verifier with umlauts", function() { + with_umlauts = { + username: "test_joakcq", + password: "fs5uofäöìfvqynn", + salt: "eec1ff4c", + v: "551e82de8d61a6575a3da7fbede61f6f38164ed52eb64db031c1ec2316b474745d3ff24408bfcca3c50fc53283f2f975feebf1564d197051c834a56bf8bd804f3696d81e579915141f306242f133db210cbd11385afff01c355ca8446d92d8a54ff147ebb0e1cd3d5c78750a0488f1453473e9449a946c7c9298c167cc5adafc" + } + calculate_and_compare_verifier(with_umlauts); + }); + + function calculate_and_compare_verifier(values) { + x = calculate.X(values.username, values.password, values.salt) + expect(calculate.V(x)).toBe(values.v); + } }); |