from mobile application when i will pass username and password if value will match with the db it should show all the details of user or else username & password invalid.For this i am generating the api. How to encrypt or decrypt the password in drupal8?
class Userverifier extends ResourceBase
{
    public function get($username = 'NULL',$password = 'NULL') {
        $result = \Drupal::database()->select('users_field_data`', 'n')
            ->fields('n', array('uid', 'name', 'pass', 'mail'))
            ->condition('n.name', $username, '=')
            //->condition('n.pass', $decrypted_pass, '=')
            ->execute()->fetchAllAssoc('uid');
        $rows = array();
        foreach ($result as $row => $content) {
            $rows[] = array('data' => array($content->uid, $content->name, $content->pass, $content->mail));
        }
        return new ResourceResponse($rows);
    }
}
 
     
     
     
    