iOS Question Convert hex byte to string

Discussion in 'iOS Questions' started by omidaghakhani1368, Feb 23, 2015.

  1. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    Hi.
    I use below code to convert md5 result to string.
    In basic4android with byteconvertor library we can convert hex byte to string but in b4i?
    Code:
    dim s as string
    s = 
    "hello"
    b1 = c1.GetMessageDigest(s.GetBytes(
    "UTF8"),"MD5")
    s = 
    BytesToString(b1,0,b1.Length,"UTF-8")
    Above code error to decoding b1
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    This code is incorrect in both B4A and B4i.

    You cannot treat raw bytes as string. If you like to convert raw bytes to hex string then you should use ByteConverter. In B4i it is part of RandomAccessFile library.
     
  3. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    Yes i know is correct because i cannot find byteconvertor
    Thank you
     
  4. Erel

    Erel Administrator Staff Member Licensed User

  5. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    Thank you Erel i can find ByteConvertor and convert hexbyte to string
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice