anchor.diff:         Alg =:= ?DNS_ALG_NSEC3RSASHA1 orelse
          Alg =:= ?DNS_ALG_RSASHA256 orelse
          Alg =:= ?DNS_ALG_RSASHA512 ->
  -    EBin = binary:encode_unsigned(crypto:erlint(E)),
  -    MBin = binary:encode_unsigned(crypto:erlint(M)),
  +    <<_MSize:32, MBin0/binary>> = M,
  +    MBin = strip_leading_zeros(MBin0),
  +    <<_ESize:32, EBin0/binary>> = E,
  +    EBin = strip_leading_zeros(EBin0),
       ESize = byte_size(EBin),
       PKBin =  if ESize =< 16#FF ->
   		     <<ESize:8, EBin:ESize/binary, MBin/binary>>;
  
positive.code: 					       public_key = PKM}, CompMap)
    when Alg =:= ?DNS_ALG_DSA orelse
         Alg =:= ?DNS_ALG_NSEC3DSA ->
      [P, Q, G, Y] = [ crypto:erlint(Mpint) || Mpint <- PKM ],
      M = byte_size(binary:encode_unsigned(P)),
      T = (M - 64) div 8,
      PKBin = <<T, Q:20/unit:8, P:M/unit:8, G:M/unit:8, Y:M/unit:8>>,
      {<<Flags:16, Protocol:8, Alg:8, PKBin/binary>>, CompMap};
  
negative.code:     Alg = term_or_arg(fun alg_to_atom/1, AlgNum),
      Key = case PublicKey of
  	      <<0, Len:16, Exp:Len/unit:8, ModBin/binary>> ->
  		  ModSize = byte_size(ModBin),
  		  <<Mod:ModSize/unit:8>> = ModBin,
  		  [crypto:mpint(Exp), crypto:mpint(Mod)];
  	      <<Len:8, Exp:Len/unit:8, ModBin/binary>> ->
  		  ModSize = byte_size(ModBin),
  		  <<Mod:ModSize/unit:8>> = ModBin,
  		  [crypto:mpint(Exp), crypto:mpint(Mod)]
  	  end,
      KeyTag = bin_to_key_tag(Bin),
  