title: Using varbinary parameter with Dapper.NET
body: <p>I'm trying to use a <code>varbinary</code> parameter with Dapper.NET as follows</p>
  
  <pre><code>string secret = "secret";
  
  // from SELECT ENCRYPTBYPASSPHRASE('secret', N'xx') &gt;&gt;;
  string ciphertext = "0x01000000393FE233AE939CA815AB744DDC39667860B3B630C82F36F7"; 
  using (var conn = new SqlConnection(...))
  {
      var result = conn.ExecuteScalar(@"SELECT CONVERT(NVARCHAR(4000), DECRYPTBYPASSPHRASE(@secret, @ciphertext)) as decrypted", 
          new
          {
              secret,
              ciphertext = Encoding.Unicode.GetBytes(ciphertext)
          });
  }
  </code></pre>
  
  <p>However the result is <code>null</code>. But it returns a valid result if I run the SQL directly eg. </p>
  
  <pre><code>SELECT CONVERT(NVARCHAR(40), DECRYPTBYPASSPHRASE('secret',  0x01000000393FE233AE939CA815AB744DDC39667860B3B630C82F36F7))
  </code></pre>
  
  <p>returns <code>xx</code> which is the encrypted text.</p>
  
  <p>Any idea what I'm doing wrong?</p>