anchor.diff:  trace(Term) -> Term.
   
   %% Keep an eye on this Pid (debug)
  +-ifndef(undefined).
   monitor_dist_proc(Pid) ->
  -%%%    spawn(
  -%%%      fun () ->
  -%%%              MRef = erlang:monitor(process, Pid),
  -%%%              receive
  -%%%                  {'DOWN', MRef, _, _, normal} ->
  -%%%                      error_logger:error_report(
  -%%%                        [dist_proc_died,
  -%%%                         {reason, normal},
  -%%%                         {pid, Pid}]);
  -%%%                  {'DOWN', MRef, _, _, Reason} ->
  -%%%                      error_logger:info_report(
  -%%%                        [dist_proc_died,
  -%%%                         {reason, Reason},
  -%%%                         {pid, Pid}])
  -%%%              end
  -%%%      end),
       Pid.
  +-else.
  +monitor_dist_proc(Pid) ->
  +    spawn(
  +      fun () ->
  +              MRef = erlang:monitor(process, Pid),
  +              receive
  +                  {'DOWN', MRef, _, _, normal} ->
  +                      error_logger:error_report(
  +                        [dist_proc_died,
  +                         {reason, normal},
  +                         {pid, Pid}]);
  +                  {'DOWN', MRef, _, _, Reason} ->
  +                      error_logger:info_report(
  +                        [dist_proc_died,
  +                         {reason, Reason},
  +                         {pid, Pid}])
  +              end
  +      end),
  +    Pid.
  +-endif.
   
   dbg() ->
       dbg:stop(),
  
positive.code: 
  encrypt_and_send_chunk(
    #params{
       socket = Socket, rekey_interval = Seq,
       shared_secret = SharedSecret,
       key = Key, iv = {IVSalt, _}, hmac_algorithm = HmacAlgo} = Params,
    Seq, Cleartext) ->
      %%
      KeyLen = byte_size(Key),
      IVSaltLen = byte_size(IVSalt),
      R = crypto:strong_rand_bytes(KeyLen + IVSaltLen + 6),
      case
          gen_tcp:send(
            Socket, encrypt_chunk(Params, Seq, [?REKEY_CHUNK, R]))
      of
          ok ->
              {Key_1, <<IVSalt_1:IVSaltLen/binary, IVNo_1:48>>} =
                  hmac_key_iv(
                    HmacAlgo, SharedSecret, R, KeyLen, IVSaltLen + 6),
              Params_1 = Params#params{key = Key_1, iv = {IVSalt_1, IVNo_1}},
              Result =
                  gen_tcp:send(Socket, encrypt_chunk(Params_1, 0, Cleartext)),
  
negative.code: %%
  %% Subsequent encrypted messages has the sequence number and the length
  %% of the message as AAD data, and an incrementing IV.  These messages
  %% has got a message type that differentiates data from ticks and rekeys.
  %% Ticks have a random size in an attempt to make them less obvious to spot.
  %%
  %% Rekeying is done by the sender that creates a new key pair and
  %% a new shared secret from the other end's public key and with
  %% this and the current key and iv hashes a new key and iv.
  %% The new public key is sent to the other end that uses it
  %% and its old private key to create the same new shared
  %% secret and from that a new key and iv.
  %% So the receiver keeps its private key, and the sender keeps
  %% the receivers public key for the connection's life time.
  %% While the sender generates a new key pair at every rekey,
  %% which changes the shared secret at every rekey.
  %%
  %% The only reaction to errors is to crash noisily (?) wich will bring
  %% down the connection and hopefully produce something useful
  %% in the local log, but all the other end sees is a closed connection.
  %% -------------------------------------------------------------------------
  
  init(Socket, Secret) ->
      #key_pair{public = PubKey} = KeyPair = get_key_pair(),
      Params = params(Socket),
      {R2, R3, Msg} = init_msg(Params, PubKey, Secret),
      ok = gen_tcp:send(Socket, Msg),
      init_recv(Params, Secret, KeyPair, R2, R3).
  
  init_recv(
    #params{socket = Socket, iv = IVLen} = Params, Secret, KeyPair, R2, R3) ->
      %%
      {ok, InitMsg} = gen_tcp:recv(Socket, 0),
      IVSaltLen = IVLen - 6,
      try
          case init_msg(Params, Secret, KeyPair, R2, R3, InitMsg) of
              {#params{iv = <<IV2ASalt:IVSaltLen/binary, IV2ANo:48>>} =
                   SendParams,
               RecvParams, SendStartMsg} ->
  