Fixed sha encoding bug for Ruby > 2.0