How to read http_userid's Base64 encoded userid from Ruby?

dhaval d. lists at ruby-forum.com
Fri Sep 9 19:29:20 UTC 2011


Hello Sven,
           I came across the same problem. But the solution you 
mentioned does not work with my program. When I run this code
cookie = CqCx7E5qMNUxrmAUAwMJAg==

cc = cookie.unpack('m*').first; rr = cc.split("").map{|c| 
c[0].to_i}.inject([]) {|v,s| v.push sprintf("%02X", s); v; 
}.values_at(3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 
12).join("")

I get back the result as "00000000000000000000000100000000" but actually 
it should be ECB1A00AD5306A4E1460AE3102090303

Do you know what am i doing wrong?

-- 
Posted via http://www.ruby-forum.com/.



More information about the nginx mailing list