title: Swift 3: Encode String to UTF-16LE
body: <p>I need to encode a string to UTF-16LE (and convert to sha1 later), but I'm having some problems. This is what I had tried:</p>
  
  <pre><code>let utf16array = Array("password".utf16)
  print(utf16array)
  // [112, 97, 115, 115, 119, 111, 114, 100]
  </code></pre>
  
  <p>But this is what I was expecting:</p>
  
  <pre><code>// [112, 0, 97, 0, 115, 0, 115, 0, 119, 0, 111, 0, 114, 0, 100, 0] 
  </code></pre>
  
  <p>Same thing using utf8array:</p>
  
  <pre><code>let utf8array = "password".utf8.map({ $0 as UInt8 })
  // [112, 97, 115, 115, 119, 111, 114, 100]
  </code></pre>
  
  <p>So, this is what I did to "fix" it:</p>
  
  <pre><code>var bytesArray:[UInt16] = []
  for byte in utf16array {
      bytesArray.append(byte)
      bytesArray.append(0)
  }
  print(bytesArray)
  // [112, 0, 97, 0, 115, 0, 115, 0, 119, 0, 111, 0, 114, 0, 100, 0]
  </code></pre>
  
  <p>But I'm sure this is not the right way. Any suggestions?</p>