>  enc_sign = Base64.encode64(sign)

Bawse64.encode64 is deprecated. Check out String#pack instead
(specifically the "m*" option).