Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to md5 in monotouch?

What's be best option for md5 hashing a string in monotouch?

Apparently traditional md5 don't work? http://lists.ximian.com/pipermail/monotouch/2009-October/001339.html

...and then checked by a ASP.net webservice.

like image 587
Niels Bosma Avatar asked Nov 17 '25 06:11

Niels Bosma


1 Answers

The email you refer to is very old (more than two years) and this was fixed a long time ago.

MD5, like all other hash algorithms (e.g. SHA1, all SHA-2 family and RIPEMD160), are all available in MonoTouch. The same is true for HMAC, symmetric and asymmetric algorithms.

The right way to create a cryptographic instance in .NET is to use the factory of the base class, e.g.

MD5 hash = MD5.Create ();

This will ensure the best implementation will be used by your code (if many are available, e.g. if a native or hardware optimized version is available) and will help make your code more portable.

like image 145
poupou Avatar answered Nov 19 '25 18:11

poupou