ES tracta d'una llibreria de Pear. Cal tenir instal·lat
Pear::Crypt_CHAP
$ sudo pear install Crypt_CHAP downloading Crypt_CHAP-1.5.0.tgz ... Starting to download Crypt_CHAP-1.5.0.tgz (5,549 bytes) .....done: 5,549 bytes install ok: channel://pear.php.net/Crypt_CHAP-1.5.0
Els fitxers instal·lats són:
$ sudo updatedb $ locate CHAP.php /usr/share/php/Crypt/CHAP.php /usr/share/php/test/Crypt_CHAP/tests/Crypt_CHAP.phpt
Un cop instal·lat es pot calcular els hashes amb:
<?php require_once 'Crypt/CHAP.php'; $pw = 'password'; $cr = new Crypt_CHAP_MSv1(); echo strtoupper(bin2hex($cr->ntPasswordHash($pw))); ?>
This method generates NT-Hash from the given plaintext-password or from the password property. The NT-Hash is computed like this: md4(str2unicode(plaintext))