In Ruby one can convert a hexadecimal string to a decimal number with String#hex method:
String#hex
"1a2f".hex # => 6703
How to do that in Crystal?
Just use String#to_i with a base of 16:
String#to_i
"1a2f".to_i(16) # => 6703