lundi 2 juin 2014

Encoding in PHP using Base64 and SHA1


Vote count:

0




I have the following JAVA code and while I know there's no simple converter to PHP I need to replicate the encoding process to PHP. I've used base64_encode before but it appears there's something else going on with SHA1 in this code?


Any ideas how to achieve this in PHP? Or at least to what this JAVA code is doing?



String password = "password";
sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
String encoded = encoder.encode(MessageDigest.getInstance("SHA1").digest(password.toUpperCase().getBytes("UTF-16LE")));
System.out.println("encoded password: " + encoded);


Thanks!


NCoder



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire