本文整理汇总了PHP中Hash类的典型用法代码示例。如果您正苦于以下问题:PHP Hash类的具体用法?PHP Hash怎么用?PHP Hash使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Hash类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createParent
public function createParent()
{
$input = Input::all();
if (Input::hasFile('profilepic')) {
$input['profilepic'] = $this->filestore(Input::file('profilepic'));
}
$input['dob'] = date('Y-m-d H:i:s', strtotime(Input::get('dob')));
$input['collegeid'] = Session::get('user')->collegeid;
$input['collegename'] = Admin::where('collegeid', '=', Session::get('user')->collegeid)->first()->collegename;
//$input['collegeid']="dummy";
//$input['collegename']="dummy";
$user = new User();
$user->email = $input['email'];
$user->password = Hash::make($input['password']);
$user->collegeid = $input['collegeid'];
$user->flag = 3;
$user->save();
$input['loginid'] = $user->id;
$removed = array('_token', 'password', 'cpassword');
foreach ($removed as $k) {
unset($input[$k]);
}
Parent::saveFormData($input);
return $input;
}
示例2: setLabel
/**
* Add a label
*
* @return void
* @author Justin Palmer
**/
public static function setLabel($key, $value)
{
if (!self::$Labels instanceof Hash) {
self::$Labels = new Hash();
}
self::$Labels->set($key, $value);
}
示例3: testFilter
public function testFilter()
{
$filter = new Hash();
$this->assertEquals('0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', $filter->apply('foo'));
$filter = new Hash('sha256');
$this->assertEquals('2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae', $filter->apply('foo'));
}
示例4: decodeHash
public function decodeHash()
{
$h = new Hash();
$this->nextToken();
$this->skipBlanks();
if ($this->c === 125) {
$this->nextToken();
return $h;
}
while ($this->c !== 125) {
$key = $this->decodeString();
$this->skipBlanks();
if ($this->c !== 58) {
throw new HException("Expected ':'.");
}
$this->nextToken();
$this->skipBlanks();
$o = $this->localDecode();
$h->set($key, $o);
$this->skipBlanks();
if ($this->c === 44) {
$this->nextToken();
$this->skipBlanks();
} else {
if ($this->c !== 125) {
throw new HException("Expected ',' or '}'. " . $this->getPositionRepresentation());
}
}
unset($o, $key);
}
$this->nextToken();
return $h;
}
示例5: generatePassword
/**
* Hashes a password.
*
* @param String $password
* @return Array
* [
* password => <string>
* salt => <string>
* ]
*/
public function generatePassword($password)
{
$hashGenerator = new Hash();
$salt = $hashGenerator->generateSalt(32);
$hashedPassword = $this->generatePasswordWithSalt($password, $salt);
return ['password' => $hashedPassword, 'salt' => $salt];
}
示例6: hash
/**
* @param $string
*
* @return Hash
*/
public function hash(string $string) : Hash
{
$hash = new Hash();
$hash->setAlgorithm($this->getAlgorithm());
$value = hash_hmac($this->getAlgorithm(), $string, $this->getSecret(), true);
$hash->setValue($value);
return $hash;
}
示例7: getAuthorizationHeader
function getAuthorizationHeader($verb, $url)
{
// UrlPath = <HTTP-Request-URI, from the port to the query string>
$str = join("\n", array($verb, $date, $url));
$h = new Hash('sha1');
$sig = base64($h->hmac(str, $privkey));
$header = 'BNET ' . $pubkey . ':' . $sig;
}
示例8: hashOfAssociativeArray
static function hashOfAssociativeArray($arr)
{
$h = new Hash();
reset($arr);
while (list($k, $v) = each($arr)) {
$h->set($k, $v);
}
return $h;
}
示例9: hasherize
public function hasherize($key)
{
$value = $this->offsetGet($key);
if (is_array($value)) {
$hash = new Hash();
return $hash->merge($value);
}
return $value;
}
示例10: fromProperties
static function fromProperties($prop)
{
$ht = new Hash();
$key = "";
$value = "";
foreach ($prop as $key => $value) {
$ht->set($key, $value);
}
return $ht;
}
示例11: computeInverse
static function computeInverse($dict)
{
$keys = $dict->keys();
$outDict = new Hash();
while ($keys->hasNext()) {
$key = $keys->next();
$outDict->set($dict->get($key), $key);
unset($key);
}
return $outDict;
}
示例12: render
function render($template, $locals = array())
{
$context = new Hash(array('response' => response(), 'request' => request(), 'route' => route()));
$context->params = $context->request->params;
$context->merge($locals);
$views = options()->get('views', __DIR__ . '/views');
$filename = realpath("{$views}/{$template}");
ob_start();
$included = php($filename, $context);
$output = ob_get_clean();
return $included ? $output : false;
}
示例13: CreateChildren
private function CreateChildren(array $array)
{
foreach ($array as $key => $value) {
if (is_array($value)) {
$tmp = new Hash();
$tmp->Load($value);
$this->offsetSet($key, $tmp);
} else {
$this->offsetSet($key, $value);
}
}
return true;
}
示例14: getRolesRoomsUsers
/**
* Return roles_rooms_users
*
* @param array $conditions Conditions by Model::find
* @return array
*/
public function getRolesRoomsUsers($conditions = array())
{
$this->Room = ClassRegistry::init('Rooms.Room');
$conditions = Hash::merge(array('Room.page_id_top NOT' => null), $conditions);
$rolesRoomsUsers = $this->find('all', array('recursive' => -1, 'fields' => array($this->alias . '.*', $this->RolesRoom->alias . '.*', $this->Room->alias . '.*'), 'joins' => array(array('table' => $this->RolesRoom->table, 'alias' => $this->RolesRoom->alias, 'type' => 'INNER', 'conditions' => array($this->alias . '.roles_room_id' . ' = ' . $this->RolesRoom->alias . ' .id')), array('table' => $this->Room->table, 'alias' => $this->Room->alias, 'type' => 'INNER', 'conditions' => array($this->RolesRoom->alias . '.room_id' . ' = ' . $this->Room->alias . ' .id'))), 'conditions' => $conditions));
return $rolesRoomsUsers;
}
示例15: edit
/**
* edit
*
* @return void
*/
public function edit()
{
//事前準備
$this->__prepare();
//リクエストセット
if ($this->request->is('post')) {
$this->set('membershipTab', Hash::get($this->request->data['SiteSetting'], 'membershipTab', 'automatic-registration'));
$this->request->data['SiteSetting'] = Hash::remove($this->request->data['SiteSetting'], 'membershipTab');
$automaticInputItems = Hash::get($this->request->data, '_siteManager.automaticInputItems', 'false');
$this->Session->write('automaticInputItems', $automaticInputItems);
$this->__parseRequestData();
$this->SiteSetting->autoRegistRoles = $this->viewVars['userRoles'];
//登録処理
$redirect = Router::parse($this->referer());
$redirect['?'] = array('membershipTab' => $this->viewVars['membershipTab']);
$this->SiteManager->saveData($redirect);
} else {
$this->set('membershipTab', Hash::get($this->request->query, 'membershipTab', 'automatic-registration'));
if ($this->Session->read('automaticInputItems')) {
$automaticInputItems = $this->Session->read('automaticInputItems');
$this->Session->delete('automaticInputItems');
} else {
$automaticInputItems = 'false';
}
$this->request->data['SiteSetting'] = $this->SiteSetting->getSiteSettingForEdit(array('SiteSetting.key' => array('AutoRegist.use_automatic_register', 'AutoRegist.confirmation', 'AutoRegist.use_secret_key', 'AutoRegist.secret_key', 'AutoRegist.role_key', 'AutoRegist.prarticipate_default_room', 'AutoRegist.disclaimer', 'AutoRegist.approval_mail_subject', 'AutoRegist.approval_mail_body', 'AutoRegist.acceptance_mail_subject', 'AutoRegist.acceptance_mail_body', 'UserRegist.mail_subject', 'UserRegist.mail_body', 'UserCancel.use_cancel_feature', 'UserCancel.disclaimer', 'UserCancel.notify_administrators', 'UserCancel.mail_subject', 'UserCancel.mail_body')));
}
$this->set('automaticInputItems', $automaticInputItems);
}