anchor.diff:  
   -compile(export_all).
   
  +%-include_lib("lager/include/log.hrl").
  +-define(debug(Fmt, Args), ok).
  +-define(error(Fmt, Args), error_logger:format(Fmt, Args)).
  +
   -record(data, {
   	  id,
   	  chal,
  
positive.code: %% 	theirs = #data{key = TheirKey}}.
  
  init(Opts) ->
      io:fwrite("~p: init(~p)~n", [?MODULE, Opts]),
      Chal = rand_bytes(4),
      MyId = proplists:get_value(id, Opts, undefined),
      case proplists:get_value(keys, Opts) of
  
negative.code: 
  %% client (1)
  send_first_challenge(Socket, St) ->
      ?debug("Sending first challenge~n", []),
      {Bin, St1} = init_challenge(St),
      exo_socket:send(Socket, Bin),
      await_response(Socket, St1).
  
  %% server (1)
  await_first_challenge(Socket, St) ->
      ?debug("await_first_challenge~n", []),
      Data = recv(Socket),
      case recv_challenge(Data, St) of
  	error ->
  	    ?debug("auth error~n", []),
  	    error;
  	{Response, St1} ->
  	    ?debug("received good challenge~n", []),
  	    exo_socket:send(Socket, Response),
  	    await_ack(Socket, St1)
      end.
  
  %% client (2)
  await_response(Socket, St) ->
      ?debug("await_response~n", []),
      Data = recv(Socket),
      case recv_challenge(Data, St) of
  	error ->
  	    ?debug("auth error~n", []),
  	    error;
  	{Response, St1} ->
  	    ?debug("received good response - auth ok~n", []),
  	    exo_socket:send(Socket, Response),
  	    {ok, St1}
      end.
  
  %% server (2)
  await_ack(Socket, St) ->
      ?debug("await_ack~n", []),
      Data = recv(Socket),
      case recv_challenge(Data, St) of
  	error ->
  	    ?debug("auth error~n", []),
  	    error;
  	{_, St1} ->
  	    ?debug("received good ack - auth ok.~n", []),
  	    {ok, St1}
      end.
  
  