<?php// this class featured hashing capabilities classMessageDigesterextendsCComponent{constALGORITM_MD5=0;constALGORITM_SHA1=1;public$salt='ibad1314';publicfunctioninit(){// overriding this method is a mandatory }// do the digesting publicfunctiondigest($_message,$_algorithm=self::ALGORITM_MD5){switch($_algorithm){caseself::ALGORITM_MD5:return$this->md5($_message);caseself::ALGORITM_SHA1:return$this->sha1($_message);default:return(NULL);}}// an md5 digesting publicfunctionmd5($_message){return(md5($_message.$this->salt));}// a sha1 digesting publicfunctionsha1($_message){return(sha1($_message.$this->salt));}}?>