Converting a C# snippit to Java
<p>The Java code should have the same functionality as the C# code.  Is this code the same?</p>

<p>This is the code in C# code:</p>

<pre><code>byte[] hashBytes;
UnicodeEncoding encoding = new UnicodeEncoding();
hashBytes = encoding.GetBytes(inputstr.Text.ToUpper().Trim());

SHA1 sha1 = new SHA1CryptoServiceProvider();

byte[] cryptPassword = sha1.ComputeHash(hashBytes);
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
SHA1.Text = enc.GetString(cryptPassword);
outputstr.Text = Convert.ToBase64String(cryptPassword);
</code></pre>

<p>Here is the Java ported code, but I'm getting different output:</p>

<pre><code>byte[] pwBytes = new String("password".toUpperCase().getBytes(), "UTF-16").getBytes();

MessageDigest md = null;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1pw = md.digest(pwBytes);

final BASE64Encoder encoder = new BASE64Encoder();
String encodedPw = encoder.encode(sha1pw);
</code></pre>

<p>The Java code should calculate encodedPw the same way that the C# code calculates outputstr.Text.</p>

<p>I'm sorry, I can not run the C# code to provide an example.  The Java code hashes "password" as <code>oghZbO1T3U/eu3POLIIQweZ/gvQ=</code>.</p>
