PHP Variable Encryption

Posted by NCoder on Stack Overflow See other posts from Stack Overflow or by NCoder
Published on 2014-06-05T15:21:30Z Indexed on 2014/06/05 15:24 UTC
Read the original article Hit count: 173

Filed under:
|
|
|
|

I have the following code that creates an encryption in PHP:

$password = "helloworld";
$passwordupper = strtoupper($password);
$passwordencode = mb_convert_encoding($passwordupper, 'UTF-16LE');
$passwordsha1 = hash("SHA1", $passwordencode);
$passwordbase64 = base64_encode($passwordsha1);

The instructions I have from the system I'm trying to connect to states:

The encoding process for passwords is: first convert to uppercase, then Unicode it in little-endian UTF 16, then SHA1 it then base64 encode it.

I think I'm doing something wrong in my code. Any ideas?!

Thanks!

NCoder

© Stack Overflow or respective owner

Related posts about php

Related posts about encryption