How do you imagine the UTF-8 line in the form of a bayth array and transfer it to function?



  • There's a code on the ball:

    var keyBytes = Encoding.UTF8.GetBytes("32 random chars");
    

    In PHP, I need to transfer this set of Byte as a key to encryption into the method. mcrypt_encrypt

    How can this be realized?



  • I don't know, really, why do you need a set of whites if https://secure.php.net/manual/ru/function.mcrypt-encrypt.php accepts the lines at the entrance.

    But use it. https://secure.php.net/manual/ru/function.unpack.php If that's what it's like:

    $byte_array = unpack('C*', $my_string);
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2