Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Hashing on iOS and Android - object reference == null

$
0
0

I have tried several cryptography classes on my app from System.Security.Crytogprahy MD5 being my original intention I have followed microsoft's example implementation to the line and yet my instance of md5 is always null.

Is there by any chance an issue with running this in iOS simulator for some reason or is it just my code?

public static string GenerateHashedPassword(string strPasswordToSave) { try { using (MD5 hasher = MD5.Create()) {
byte[] data = hasher.ComputeHash (Encoding.UTF8.GetBytes (strPasswordToSave));

        StringBuilder sB = new StringBuilder ();

        for (int i = 0; i < data.Length; i++) 
        {
            sB.Append (data [i].ToString ("x2"));
        }
        Console.WriteLine (sB.ToString ());
        return sB.ToString ();
    }
}
catch(Exception e){Console.WriteLine (e.Message);}
return "";

}


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>