Jump to content
php.lv forumi

Kā pārvērst stringu uz byteArray?


fjckls

Recommended Posts

Man ir jāatrisina šāds te:

Before calculating the MD5 hash, string should most likely be converted to a byte array: when doing so, it should be treated as 7-bit ASCII. After calculating the MD5 hash, the resulting byte array containing the hash is base-64 encoded.

For example:

BASE64(MD5(TEST1234|MM00402320|MDB@INTERMEZZOGROUP.COM|PREVIEW)) = zqdmWws60Bq80I2RFkgW1Q==

 

Izmeklējos un netieku gudrs kā iespējams "string should most likely be converted to a byte array",

Pagaidu kods, kas nestrādā:

 

<?php

$one = "TEST1234";
$two = "MM00402320";
$three = "MDB@INTERMEZZOGROUP.COM";
$four = "PREVIEW))";
$strng = $one . "|" . $two . "|" . $three . "|" . $four;

$hash = base64_encode(md5($strng));

echo $hash;
// NjNhZjFmN2NmMGY1NjU0NjE1MmZlMTIyMzRkZjdkMGY= bet jaabuut zqdmWws60Bq80I2RFkgW1Q==
?>

 

Hmm.. kādas idejas?

PAldies!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...