PHP Pack() and unpack()

Discussion in 'Web Design & Programming' started by yunyat, May 24, 2011.

  1. yunyat

    yunyat Geek Trainee

    Likes Received:
    Trophy Points:
    Hi , i am currently learning about mcrypt and all its functions, until i came across the "pack()" function in my ebook. The book hashes the encryption key then packs it .e.g.

    $encryptionKey = pack('H*', $md5InputKey)

    Then the book says the hash hexadecimal value is converted into binary data, so that each byte has a full 256-bit range of values.

    I dont understand this explanation. full 256-range of values ? how does that work? Can anyone shed any light on this ? plus, can anyone tell me why someone would use pack and unpack, is there an advantage to converting data into binary format?

    Any help is greatly appreciated , thank you.

Share This Page