title: How can I convert a String to an MD5 hash in iOS using Swift?
body: <p>I want to convert a string like "abc" to an MD5 hash. I want to do this in iOS and Swift. I have tried using the solutions below but they were not working for me:</p>
  
  <p><a href="https://stackoverflow.com/questions/25248598/importing-commoncrypto-in-a-swift-framework">Importing CommonCrypto in a Swift framework</a></p>
  
  <p><a href="https://stackoverflow.com/questions/24123518/how-to-use-cc-md5-method-in-swift-language">How to use CC_MD5 method in swift language.</a></p>
  
  <p><a href="http://iosdeveloperzone.com/2014/10/03/using-commoncrypto-in-swift/" rel="noreferrer">http://iosdeveloperzone.com/2014/10/03/using-commoncrypto-in-swift/</a></p>
  
  <p>To be more clear, I want to achieve an output in Swift similar to this PHP code's output:</p>
  
  <pre><code>$str = "Hello";
  
  echo md5($str);
  </code></pre>
  
  <p>Output: 8b1a9953c4611296a827abf8c47804d7</p>