anchor.diff:    sign_keypair_public_valid(KP) andalso sign_keypair_secret_valid(KP).
   
   prop_sign() ->
  -    ?FORALL({Msg, KeyPair}, {binary(), fault_rate(1, 40, sign_keypair())},
  +    ?FORALL({Msg, KeyPair}, {g_iodata(), fault_rate(1, 40, sign_keypair())},
         begin
  -        case sign_keypair_secret_valid(KeyPair) of
  +        case v_iodata(Msg) andalso sign_keypair_secret_valid(KeyPair) of
             true ->
               #{ secret := Secret } = KeyPair,
               enacl:sign(Msg, Secret),
  
positive.code:               badargs(fun() -> enacl:stream(Len, Nonce, Key) end)
          end).
  
  prop_stream_xor_correct() ->
      ?FORALL({Msg, Nonce, Key},
              {binary(),
               fault_rate(1, 40, nonce()),
               fault_rate(1, 40, secret_key())},
          case nonce_valid(Nonce) andalso secret_key_valid(Key) of
              true ->
                  CipherText = enacl:stream_xor(Msg, Nonce, Key),
                  equals(Msg, enacl:stream_xor(CipherText, Nonce, Key));
              false ->
                  badargs(fun() -> enacl:stream_xor(Msg, Nonce, Key) end)
          end).
  
negative.code:     frequency([
          {5, ?SUCHTHAT(B, binary(), byte_size(B) /= Sz)},
          {1, elements([a, b])},
          {1, int()},
          {1, g_iodata()}
      ]).
      
  v_binary(Sz, N) when is_binary(N) ->
      byte_size(N) == Sz;
  v_binary(_, _) -> false.
  
                    
  %% Typical generators based on the binaries
  nonce() -> g_binary(enacl:box_nonce_size()).
  nonce_valid(N) -> v_binary(enacl:box_nonce_size(), N).
  