binary_to_integer(Bin)-> erlang:list_to_integer(bin_to_hex(Bin), 16).
bin_to_hex(Bin) -> [hd(erlang:integer_to_list(I, 16)) || << I:4 >> <= Bin ].
integer_to_binary(Int)-> hex_to_bin(erlang:integer_to_list(Int, 16)).
hex_to_bin(Str) -> << << (erlang:list_to_integer([H], 16)):4 >> || H <- Str >>.
Hint from : http://stackoverflow.com/questions/965038/hex-to-64-signed-decimal
댓글 없음:
댓글 쓰기