X-Git-Url: https://code.kerkeslager.com/?p=sandbox;a=blobdiff_plain;f=cryptopals-erlang%2F01.03%2Fmain.erl;fp=cryptopals-erlang%2F01.03%2Fmain.erl;h=034b0d9d71878000859ddda1d623414f909b0d13;hp=0000000000000000000000000000000000000000;hb=b37c633b0ba51e497920762fa2eb4d732ebca291;hpb=545381e1397107d4ab00d2e54d85d3e11d98e4f1 diff --git a/cryptopals-erlang/01.03/main.erl b/cryptopals-erlang/01.03/main.erl new file mode 100644 index 0000000..034b0d9 --- /dev/null +++ b/cryptopals-erlang/01.03/main.erl @@ -0,0 +1,17 @@ +-module(main). +-export([run/0]). + +% TODO Scoring function to identify which string is English + +get_xored_possibilities() -> + Base = hex:decode("1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736"), + XorBytes = lists:seq(0,255), + lists:map(fun(XorByte) -> hex:single_byte_xor(XorByte,Base) end, XorBytes). + +get_comparison_text() -> + {ok, Data} = file:read_file("1984.html"), + Data. + +print_all(List) -> lists:map(fun(S) -> io:format("~s~n",[S]) end, List). + +run() -> print_all(get_xored_possibilities()).