9 Ağustos 2007 Perşembe

Convert MD5 hash from Hex to Base64 encoding

def MD5hex2base64(str)
h1=[].clear

# split the 32 byte hex into a 16 byte array
16.times{ h1.push(str.slice!(0,2).hex) }
# pack (C* = unsigned char), (m = base64 encoded output)
[h1.pack("C*")].pack("m")
end


0 Comments: