Last Updated: February 25, 2016
·
1.45K
· tmilewski

Easy MD5/SHA1 Hashes in RubyMotion

I've seen a lot of people using CocoaPods to hash strings in RubyMotion. While this seemingly works (I wasn't able to get it to), there's an easier way.

A gem was released called 'RmDigest' which allows you to easily throw this functionality into your app. (In the background, it's actually utilizing the same Obj-C library.)

Gemfile:

gem 'rm-digest'

Rakefile:

require 'rm-digest'

Usage:

sha1 = RmDigest::SHA1.hexdigest('foo')
md5  = RmDigest::MD5.hexdigest('bar')

Github | RubyGems