-spec client_key(binary(), binary()) -> binary().
client_key(ClientProof, ClientSignature) ->
- list_to_binary(lists:zipwith(fun (X, Y) -> X bxor Y end,
- binary_to_list(ClientProof),
- binary_to_list(ClientSignature))).
+ crypto:exor(ClientProof, ClientSignature).
-spec server_signature(binary(), binary()) -> binary().
hi(Password, Salt, IterationCount) ->
U1 = sha_mac(Password, <<Salt/binary, 0, 0, 0, 1>>),
- list_to_binary(lists:zipwith(fun (X, Y) -> X bxor Y end,
- binary_to_list(U1),
- binary_to_list(hi_round(Password, U1,
- IterationCount - 1)))).
+ crypto:exor(U1, hi_round(Password, U1, IterationCount - 1)).
hi_round(Password, UPrev, 1) ->
sha_mac(Password, UPrev);
hi_round(Password, UPrev, IterationCount) ->
U = sha_mac(Password, UPrev),
- list_to_binary(lists:zipwith(fun (X, Y) -> X bxor Y end,
- binary_to_list(U),
- binary_to_list(hi_round(Password, U,
- IterationCount - 1)))).
+ crypto:exor(U, hi_round(Password, U, IterationCount - 1)).
sha_mac(Key, Data) ->
crypto:hmac(sha, Key, Data).