I have an email and want to pull the corresponding image from gravatar.com
With ruby, it's easy:
require 'Digest/md5'
Digest::MD5.hexdigest("my string")
Since there is no require
method in RubyMotion, how do I generate the hash from the email?
One possibility is using the "NSData+MD5" cocoapod. Install it by adding this to your Rakefile (make sure you have require 'motion-cocoapods'
up top):
app.pods do
pod 'NSData+MD5Digest'
end
Then you can use it like this:
digest = NSData.MD5HexDigest("my string".dataUsingEncoding(NSUTF8StringEncoding))