I'm taking a task converting Java code to Objective C.
This is the code in Java that I have to convert:
private String getHash(String input) 
{
    String ret = null;
    try 
    {
        MessageDigest md = MessageDigest.getInstance("SHA-256");
        byte[] bs = md.digest(input.getBytes("US-ASCII"));
        StringBuffer sb = new StringBuffer();
        for (byte b : bs) 
        {
            String bt = Integer.toHexString(b & 0xff);
            if(bt.length()==1) 
            {
                sb.append("0");
            }
            sb.append(bt);
        }
        ret = sb.toString();
    } 
    catch (Exception e) 
    {
    }
    return ret;
}
Specifically, what can I use in Objective C which has the same functionality as the MessageDigest class?
 
     
     
     
    