• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Hash类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Hash的典型用法代码示例。如果您正苦于以下问题:PHP Hash类的具体用法?PHP Hash怎么用?PHP Hash使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Hash类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
 }
开发者ID:pankaja455,项目名称:WebSchool,代码行数:25,代码来源:ParentController.php


示例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);
 }
开发者ID:ToddBudde,项目名称:phrails,代码行数:13,代码来源:FlashForm.php


示例3: testFilter

 public function testFilter()
 {
     $filter = new Hash();
     $this->assertEquals('0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', $filter->apply('foo'));
     $filter = new Hash('sha256');
     $this->assertEquals('2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae', $filter->apply('foo'));
 }
开发者ID:seytar,项目名称:psx,代码行数:7,代码来源:HashTest.php


示例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;
 }
开发者ID:komcdo,项目名称:winnow,代码行数:33,代码来源:JSon.class.php


示例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];
 }
开发者ID:Liviath,项目名称:saveCodeManager,代码行数:17,代码来源:Password.php


示例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;
 }
开发者ID:blar,项目名称:hash,代码行数:13,代码来源:HmacHashGenerator.php


示例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;
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:8,代码来源:wow.php


示例8: hashOfAssociativeArray

 static function hashOfAssociativeArray($arr)
 {
     $h = new Hash();
     reset($arr);
     while (list($k, $v) = each($arr)) {
         $h->set($k, $v);
     }
     return $h;
 }
开发者ID:ralcr,项目名称:Apple-s-Dictionary-App-database-generator,代码行数:9,代码来源:Lib.class.php


示例9: hasherize

 public function hasherize($key)
 {
     $value = $this->offsetGet($key);
     if (is_array($value)) {
         $hash = new Hash();
         return $hash->merge($value);
     }
     return $value;
 }
开发者ID:amptools-net,项目名称:midori-php,代码行数:9,代码来源:Hash.php


示例10: fromProperties

 static function fromProperties($prop)
 {
     $ht = new Hash();
     $key = "";
     $value = "";
     foreach ($prop as $key => $value) {
         $ht->set($key, $value);
     }
     return $ht;
 }
开发者ID:Raniratna,项目名称:new_elearning,代码行数:10,代码来源:PropertiesTools.class.php


示例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;
 }
开发者ID:komcdo,项目名称:winnow,代码行数:11,代码来源:ConfigurationKeys.class.php


示例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;
}
开发者ID:noonat,项目名称:pipes,代码行数:12,代码来源:helpers.php


示例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;
 }
开发者ID:BookOfOrigin,项目名称:Ori,代码行数:13,代码来源:Hash.php


示例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;
 }
开发者ID:Onasusweb,项目名称:Rooms,代码行数:13,代码来源:RolesRoomsUser.php


示例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);
 }
开发者ID:NetCommons3,项目名称:SiteManager,代码行数:33,代码来源:MembershipController.php


示例16: password_update

 public static function password_update($password, $user = NULL)
 {
     if ($user or $user = self::find(Auth::user()->id)) {
         $user->pass = Hash::make($password);
         return $user->save();
     }
 }
开发者ID:bankorh,项目名称:ecom1_laravel,代码行数:7,代码来源:user.php


示例17: defaultUserAttributeRole

 /**
  * UserAttributesRoleのデフォルト値
  *
  * * パスワード=自分/他人とも読み取り不可
  * * ラベル項目=自分/他人とも書き込み不可
  * * 会員管理が使用可=上記以外、自分・他人とも自分/他人の読み・書き可
  * * 会員管理が使用不可
  * ** 管理者以外、読み取り不可項目とする=自分/他人の読み・書き不可。※読めないのに書けるはあり得ないため。
  * ** 管理者以外、書き込み不可項目とする=自分/他人の書き込み不可。
  * ** 上記以外
  * *** ハンドル・アバター=自分は、読み・書き可。他人は、読み取り可/書き込み不可。
  * *** それ以外=自分は、読み・書き可。他人は、読み・書き不可。
  *
  * @param Model $model Model using this behavior
  * @param array|string $userAttrSetting 配列:ユーザ属性設定データ、文字列:ユーザ属性キー
  * @param bool $enableUserManager 有効かどうか
  * @return array ユーザ属性ロールデータ
  */
 public function defaultUserAttributeRole(Model $model, $userAttrSetting, $enableUserManager)
 {
     $model->loadModels(['UserAttributeSetting' => 'UserAttributes.UserAttributeSetting']);
     $userAttrSetting = $model->UserAttributeSetting->create($userAttrSetting);
     $userAttributeRole = array();
     $userAttributeRole['UserAttributesRole']['self_readable'] = true;
     $userAttributeRole['UserAttributesRole']['self_editable'] = true;
     $userAttributeKey = $userAttrSetting['UserAttributeSetting']['user_attribute_key'];
     if ($userAttributeKey === UserAttribute::PASSWORD_FIELD) {
         $userAttributeRole['UserAttributesRole']['self_readable'] = false;
         $userAttributeRole['UserAttributesRole']['other_readable'] = false;
     } elseif ($enableUserManager) {
         $userAttributeRole['UserAttributesRole']['other_readable'] = true;
     } elseif (Hash::get($userAttrSetting, 'UserAttributeSetting.only_administrator_readable')) {
         $userAttributeRole['UserAttributesRole']['self_readable'] = false;
         $userAttributeRole['UserAttributesRole']['other_readable'] = false;
         $userAttrSetting['UserAttributeSetting']['only_administrator_editable'] = true;
     } else {
         $userAttributeRole['UserAttributesRole']['self_readable'] = true;
         $userAttributeRole['UserAttributesRole']['other_readable'] = in_array($userAttributeKey, $this->readableDefault, true);
     }
     $userAttributeRole['UserAttributesRole']['other_editable'] = false;
     if ($userAttrSetting['UserAttributeSetting']['data_type_key'] === DataType::DATA_TYPE_LABEL) {
         $userAttributeRole['UserAttributesRole']['self_editable'] = false;
     } elseif ($enableUserManager) {
         $userAttributeRole['UserAttributesRole']['other_editable'] = true;
     } elseif (Hash::get($userAttrSetting, 'UserAttributeSetting.only_administrator_editable')) {
         $userAttributeRole['UserAttributesRole']['self_editable'] = false;
     }
     return $userAttributeRole;
 }
开发者ID:NetCommons3,项目名称:UserRoles,代码行数:49,代码来源:UserAttributesRoleBehavior.php


示例18: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     for ($i = 0; $i < 40; $i++) {
         \DB::table('usuarios')->insert(array('snombre' => $faker->firstname, 'sapellido' => $faker->lastname, 'scontrasena' => \Hash::make('12345'), 'scorreo' => $faker->unique()->email, 'badministra' => 0));
     }
 }
开发者ID:matc04,项目名称:Laravel,代码行数:12,代码来源:UsuarioSeed.php


示例19: add

 /**
  * Adds new task
  *
  * @param string $command
  * @param string $path
  * @param array $arguments
  * @param array $options
  * - `unique` - if true and found active duplicates wont add new task
  * - `dependsOn` - an array of task ids that must be done before this task starts
  * @return bool
  */
 public function add($command, $path, array $arguments = array(), array $options = array())
 {
     $dependsOn = (array) Hash::get($options, 'dependsOn');
     $unique = (bool) Hash::get($options, 'unique');
     unset($options['dependsOn'], $options['unique']);
     $task = compact('command', 'path', 'arguments') + $options;
     $task += array('timeout' => 60 * 60, 'status' => TaskType::UNSTARTED, 'code' => 0, 'stdout' => '', 'stderr' => '', 'details' => array(), 'server_id' => 0, 'scheduled' => null, 'hash' => $this->_hash($command, $path, $arguments));
     $dependsOnIds = $this->find('list', array('fields' => array('id', 'id'), 'conditions' => array('hash' => $task['hash'], 'status' => array(TaskType::UNSTARTED, TaskType::DEFFERED, TaskType::RUNNING))));
     if ($unique && $dependsOnIds) {
         return false;
     } elseif ($dependsOnIds) {
         $dependsOn = array_merge($dependsOn, $dependsOnIds);
     }
     $this->create();
     if ($dependsOn) {
         $data = array($this->alias => $task, $this->DependsOnTask->alias => $dependsOn);
         $success = $this->saveAssociated($data);
     } else {
         $success = $this->save($task);
     }
     if (!$success) {
         return false;
     } else {
         return $this->read()[$this->alias];
     }
 }
开发者ID:imsamurai,项目名称:cakephp-task-plugin,代码行数:37,代码来源:TaskClient.php


示例20: postNew

 public function postNew()
 {
     $validation = new Validators\SeatUserRegisterValidator();
     if ($validation->passes()) {
         // Let's register a user.
         $user = new \User();
         $user->email = Input::get('email');
         $user->username = Input::get('username');
         $user->password = Hash::make(Input::get('password'));
         $user->tsid = Input::get('tsid');
         $user->activation_code = str_random(24);
         $user->activated = 1;
         $user->save();
         // Prepare data to be sent along with the email. These
         // are accessed by their keys in the email template
         $data = array('activation_code' => $user->activation_code);
         // Send the email with the activation link
         Mail::send('emails.auth.register', $data, function ($message) {
             $message->to(Input::get('email'), 'New SeAT User')->subject('SeAT Account Confirmation');
         });
         // And were done. Redirect to the login again
         return Redirect::action('SessionController@getSignIn')->with('success', 'Successfully registered a new account. Please check your email for the activation link.');
     } else {
         return Redirect::back()->withInput()->withErrors($validation->errors);
     }
 }
开发者ID:orloc,项目名称:seat,代码行数:26,代码来源:RegisterController.php



注:本文中的Hash类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Head类代码示例发布时间:2022-05-23
下一篇:
PHP Harmoni类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap