dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: PHP Pack() and unpack()

  1. #1
    Join Date
    Mar 2010
    Location
    Australia, Sydney
    Posts
    12

    Exclamation PHP Pack() and unpack()

    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.

  2. #2
    Join Date
    Oct 2008
    Location
    Seattle, Wa
    Posts
    695
    I know Binary is easily readable, but it makes me wonder why they don't use hex2bin() instead? Maybe because it doesn't have a reverse function?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles