plist_values['HashData'].join("").unpack('m')[0].each_byte do |b|
hash_decoded << sprintf("%02X", b)
end
I need to translate it to other language. As I understood, it puts all contents of 'HashData' array into a string, then decodes it from Base64, But what's next? Can you write me a step-by step explanation what it does? Thanks in Advance!
join("")
concatenates all the strings in the array (or what each element in the array returns when calling to_s
).unpack('m')
from the docs decodes the string (and it assumes it is base64 encoded).sprintf("%02X", b)
from the docs returns the hexadecimal representation with upper case letters.hash_decoded << ..
appends the hex representation to the stringThe bottom line is that you get a string that represents the hexadecimal version (with upper case letters) of the joined strings in plist_values['HashData']
.