I'm trying to understand this line of ruby code:
So I'm going to break this down. The first step is
token.unpack('m0'). According to Idiosyncratic Ruby
unpack('m0') will decode base64, similarly to the built-in
Base64.decode64(string) function. But unpack returns an arry here, with only 1 element, the converted base64. So we use
token.unpack('m0').first to get the first (and in this case the only) element of the array returned by
token.unpack('m0'). If this was all, then you'd be correct to say that it's just base64. But, the unpacked base64 is unpacked again, this time with
'H*', which will convert the characters to hex. And finally, because that will return an array, you use first again to make it only a string.
So in summary, what is happening is that first your string is being decoded from base64 to a string, then it's being converted to hex.