Add more patterns kk, nx, xn, in, ik, xx, and ix

This commit is contained in:
Hans Svensson 2018-03-06 10:35:40 +01:00
parent b1d63ad3b9
commit 0d38f56d6a

View File

@ -93,8 +93,27 @@ protocol(kn) ->
{[{out, [s]}], [{out, [e]}, {in, [e, ee, se]}]}; {[{out, [s]}], [{out, [e]}, {in, [e, ee, se]}]};
protocol(nk) -> protocol(nk) ->
{[{in, [s]}], [{out, [e, es]}, {in, [e, ee]}]}; {[{in, [s]}], [{out, [e, es]}, {in, [e, ee]}]};
protocol(kk) ->
{[{out, [s]}, {in, [s]}], [{out, [e, es, ss]}, {in, [e, ee, se]}]};
protocol(nx) ->
{[], [{out, [e]}, {in, [e, ee, s, es]}]};
protocol(kx) ->
{[{out, [s]}], [{out, [e]}, {in, [e, ee, se, s, es]}]};
protocol(xn) ->
{[], [{out, [e]}, {in, [e, ee]}, {out, [s, se]}]};
protocol(in) ->
{[], [{out, [e, s]}, {in, [e, ee, se]}]};
protocol(xk) -> protocol(xk) ->
{[{in, [s]}], [{out, [e, es]}, {in, [e, ee]}, {out, [s, se]}]}. {[{in, [s]}], [{out, [e, es]}, {in, [e, ee]}, {out, [s, se]}]};
protocol(ik) ->
{[{in, [s]}], [{out, [e, es, s, ss]}, {in, [e, ee, se]}]};
protocol(xx) ->
{[], [{out, [e]}, {in, [e, ee, s, es]}, {out, [s, se]}]};
protocol(ix) ->
{[], [{out, [e, s]}, {in, [e, ee, se, s, es]}]}.
supported_pattern(P) ->
lists:member(P, [nn, kn, nk, kk, nx, kx, xn, in, xk, ik, xx, ix]).
supported_hash(Hash) -> supported_hash(Hash) ->
lists:member(Hash, [blake2b, sha256, sha512]). lists:member(Hash, [blake2b, sha256, sha512]).
@ -105,9 +124,6 @@ supported_cipher(Cipher) ->
supported_dh(Dh) -> supported_dh(Dh) ->
lists:member(Dh, [dh25519]). lists:member(Dh, [dh25519]).
supported_pattern(P) ->
lists:member(P, [nn, kn, nk, xk]).
to_name(Pattern, Dh, Cipher, Hash) -> to_name(Pattern, Dh, Cipher, Hash) ->
list_to_binary(lists:join("_", ["Noise", to_name_pattern(Pattern), to_name_dh(Dh), list_to_binary(lists:join("_", ["Noise", to_name_pattern(Pattern), to_name_dh(Dh),
to_name_cipher(Cipher), to_name_hash(Hash)])). to_name_cipher(Cipher), to_name_hash(Hash)])).