100+ results for 'php sha1'

Not the results you expected?

Repo.php (https://gitlab.com/scribe-inc/ScribeGitHubApiLibrary) PHP · 438 lines

1 <?php

2

3 namespace Github\Api;

423 * @param string $repository

424 * @param string $base The name of the base branch that the head will be merged into.

425 * @param string $head The head to merge. This can be a branch name or a commit SHA1.

426 * @param string $message Commit message to use for the merge commit. If omitted, a default message will be used.

427 *

OpenSSLSignature.java (https://bitbucket.org/aways/android_libcore.git) Java · 303 lines

67 * Creates a new OpenSSLSignature instance for the given algorithm name.

68 *

69 * @param algorithm OpenSSL name of the algorithm, e.g. "RSA-SHA1".

70 */

71 private OpenSSLSignature(String algorithm, EngineType engineType)

275 }

276 }

277 public static final class SHA1RSA extends OpenSSLSignature {

278 public SHA1RSA() throws NoSuchAlgorithmException {

279 super("RSA-SHA1", EngineType.RSA);

280 }

281 }

295 }

296 }

297 public static final class SHA1DSA extends OpenSSLSignature {

298 public SHA1DSA() throws NoSuchAlgorithmException {

BasesfGuardUser.class.php (https://github.com/arturolinares/asandbox.git) PHP · 199 lines

1 <?php

2

3 /**

77 * @subpackage model

78 * @author Your name here

79 * @version SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $

80 */

81 abstract class BasesfGuardUser extends sfDoctrineRecord

98 $this->hasColumn('algorithm', 'string', 128, array(

99 'type' => 'string',

100 'default' => 'sha1',

101 'notnull' => true,

102 'length' => 128,

smarty_internal_config.php (https://github.com/tedkulp/cmsmadesimple-2-0.git) PHP · 270 lines

1 <?php

2 /**

3 * Smarty Internal Plugin Config

138 $_flag = (int)$this->smarty->config_read_hidden + (int)$this->smarty->config_booleanize * 2 +

139 (int)$this->smarty->config_overwrite * 4;

140 $_filepath = sha1($this->config_resource_name . $_flag);

141 // if use_sub_dirs, break file into directories

142 if ($this->smarty->use_sub_dirs) {

150 $_compile_dir .= DS;

151 }

152 return $_compile_dir . $_filepath . '.' . basename($this->config_resource_name) . '.config' . '.php';

153 }

154 /**

237 {

238 if (isset($this->template)) {

239 $this->template->properties['file_dependency'][sha1($this->getConfigFilepath())] = array($this->getConfigFilepath(), $this->getTimestamp());

240 } else {

241 $this->smarty->properties['file_dependency'][sha1($this->getConfigFilepath())] = array($this->getConfigFilepath(), $this->getTimestamp());

classtrees_OpenID.html (https://github.com/yupe/xomaprojects.git) HTML · 208 lines

56 <h2>Root class Auth_OpenID_DiffieHellmanSHA1ConsumerSession</h2>

57 <ul>

58 <li><a href="OpenID/Auth_OpenID_DiffieHellmanSHA1ConsumerSession.html">Auth_OpenID_DiffieHellmanSHA1ConsumerSession</a><ul>

59 <li><a href="OpenID/Auth_OpenID_DiffieHellmanSHA256ConsumerSession.html">Auth_OpenID_DiffieHellmanSHA256ConsumerSession</a></li></ul></li>

60 </ul>

62 <h2>Root class Auth_OpenID_DiffieHellmanSHA1ServerSession</h2>

63 <ul>

64 <li><a href="OpenID/Auth_OpenID_DiffieHellmanSHA1ServerSession.html">Auth_OpenID_DiffieHellmanSHA1ServerSession</a><ul>

65 <li><a href="OpenID/Auth_OpenID_DiffieHellmanSHA256ServerSession.html">Auth_OpenID_DiffieHellmanSHA256ServerSession</a></li></ul></li>

66 </ul>

176 <h2>Root class Auth_Yadis_PHPSession</h2>

177 <ul>

178 <li><a href="OpenID/Auth_Yadis_PHPSession.html">Auth_Yadis_PHPSession</a></li></ul>

179

180 <h2>Root class Auth_Yadis_Service</h2>

smarty_cacheresource_custom.php (https://github.com/usualoma/movabletype.git) PHP · 297 lines

1 <?php

2 /**

3 * Smarty Internal Plugin

86 $_compile_id = isset($cached->compile_id) ? preg_replace('![^\w]+!', '_', $cached->compile_id) : null;

87 $path = $cached->source->uid . $_cache_id . $_compile_id;

88 $cached->filepath = sha1($path);

89 if ($_template->smarty->cache_locking) {

90 $cached->lock_id = sha1('lock.' . $path);

AWSAuthTest.php (https://bitbucket.org/freshflow/sabredav-1.8.5-fork.git) PHP · 242 lines

1 <?php

2

3 namespace Sabre\HTTP;

4

5 require_once 'Sabre/HTTP/ResponseMock.php';

6

7 class AWSAuthTest extends \PHPUnit_Framework_TestCase {

189

190

191 $sig = base64_encode($this->hmacsha1($secretKey,

192 "POST\n$contentMD5\n\n$date\nx-amz-date:$date\n/evert"

193 ));

235 $ipad=str_repeat(chr(0x36),$blocksize);

236 $opad=str_repeat(chr(0x5c),$blocksize);

237 $hmac = pack('H*',sha1(($key^$opad).pack('H*',sha1(($key^$ipad).$message))));

238 return $hmac;

239

provider.php (https://bitbucket.org/chakkimatti/vv2.git) PHP · 289 lines

1 <?php namespace OneAuth\OAuth;

2

3 /**

85 * @var string signature type

86 */

87 protected $signature = 'HMAC-SHA1';

88

89 /**

Rsa.php (https://github.com/obias/zf2.git) PHP · 306 lines

1 <?php

2 /**

3 * Zend Framework

52 protected $_certificatePath = null;

53

54 protected $_hashAlgorithm = OPENSSL_ALGO_SHA1;

55

56 protected $_passPhrase = null;

196 $publicKey = null;

197 $resource = openssl_pkey_new($config);

198 // above fails on PHP 5.3

199

200 openssl_pkey_export($resource, $private, $passPhrase);

255 $this->_hashAlgorithm = OPENSSL_ALGO_MD5;

256 break;

257 case 'sha1':

258 $this->_hashAlgorithm = OPENSSL_ALGO_SHA1;

smarty_internal_config.php (https://bitbucket.org/mrajoelisolo/ci_smarty.git) PHP · 302 lines

1 <?php

2 /**

3 * Smarty Internal Plugin Config

105 $_flag = (int) $this->smarty->config_read_hidden + (int) $this->smarty->config_booleanize * 2

106 + (int) $this->smarty->config_overwrite * 4;

107 $_filepath = sha1($this->source->name . $_flag);

108 // if use_sub_dirs, break file into directories

109 if ($this->smarty->use_sub_dirs) {

118 }

119 $_compile_dir = $this->smarty->getCompileDir();

120 return $_compile_dir . $_filepath . '.' . basename($this->source->name) . '.config' . '.php';

121 }

122

209 {

210 if ($this->data instanceof Smarty_Internal_Template) {

211 $this->data->properties['file_dependency'][sha1($this->source->filepath)] = array($this->source->filepath, $this->source->timestamp, 'file');

212 }

213 if ($this->mustCompile()) {

PBE.java (https://github.com/xl8or/-.git) Java · 238 lines

9 import myorg.bouncycastle.crypto.digests.MD5Digest;

10 import myorg.bouncycastle.crypto.digests.RIPEMD160Digest;

11 import myorg.bouncycastle.crypto.digests.SHA1Digest;

12 import myorg.bouncycastle.crypto.digests.SHA256Digest;

13 import myorg.bouncycastle.crypto.digests.TigerDigest;

48 break;

49 case 1:

50 SHA1Digest var5 = new SHA1Digest();

51 var3 = new PKCS5S1ParametersGenerator(var5);

52 break;

69 break;

70 case 1:

71 SHA1Digest var8 = new SHA1Digest();

72 var3 = new PKCS12ParametersGenerator(var8);

73 break;

GdataMedia.php (https://gitlab.com/Japang-Jawara/jawara-penilaian) PHP · 547 lines

1 <?php

2 /*

3 * Copyright 2014 Google Inc.

108 * @var string

109 */

110 public $sha1Hash;

111 /**

112 * @var string

489 * @param string

490 */

491 public function setSha1Hash($sha1Hash)

492 {

493 $this->sha1Hash = $sha1Hash;

496 * @return string

497 */

498 public function getSha1Hash()

499 {

500 return $this->sha1Hash;

sha1.hpp (https://gitlab.com/amyasnikov/xgame) C++ Header · 313 lines

8 //

9

10 #ifndef BOOST_BEAST_DETAIL_SHA1_HPP

11 #define BOOST_BEAST_DETAIL_SHA1_HPP

15 #include <cstring>

16

17 // Based on https://github.com/vog/sha1

18 /*

19 Original authors:

29 namespace detail {

30

31 namespace sha1 {

32

33 static std::size_t constexpr BLOCK_INTS = 16;

218 }

219

220 } // sha1

221

222 struct sha1_context

ss_spl.c (https://gitlab.com/pine64-android/brandy) C · 414 lines

123 }

124

125 //send last 512-bits text to SHA1/MD5

126 for(i=0; i<16; i++){

127 padding_buf[i] = 0x0;

IoHookTest.java (https://gitlab.com/zozoh/walnut) Java · 295 lines

232 + "\n",

233 txt);

234 assertEquals(Lang.sha1(txt), o.sha1());

235 }

236

252 String txt = io.readText(o);

253 assertEquals(Lang.md5("/home/xiaobai/abc.txt\n") + "\n", txt);

254 assertEquals(Lang.sha1(txt), o.sha1());

255 }

256

271 String txt = io.readText(o);

272 assertEquals(Lang.md5("/home/xiaobai/abc.txt\n") + "\n", txt);

273 assertEquals(Lang.sha1(txt), o.sha1());

274 }

275

user.php (https://github.com/cgajardo/repositorium.git) PHP · 265 lines

1 <?php

2 class User extends AppModel {

3 var $name = 'User';

139 if(!empty($this->data['User']['password'])) {

140 $this->data['User']['salt'] = mt_rand();

141 $this->data['User']['password'] = sha1($this->data['User']['password'] . $this->data['User']['salt']);

142 }

143

183

184 $pass_to_check = $d['User']['password'];

185 $pass_from_login = sha1($data['User']['password'] . $d['User']['salt']);

186 if(strcmp($pass_to_check,$pass_from_login) == 0) {

187 return $d;

config.html (https://github.com/mrmark/moodle.git) HTML · 289 lines

1 <?php

2 global $OUTPUT;

3 // set to defaults if undefined

57

58 <tr valign="top" class="required">

59 <td align="right"><label for="host"><?php print_string("auth_dbhost_key", "auth_db") ?></label></td>

60 <td>

61 <input id="host" name="host" type="text" class="text-ltr" size="30" value="<?php echo $config->host?>" />

62 <?php

63

64 if (isset($err["host"])) {

194 $passtype["plaintext"] = get_string("plaintext", "auth");

195 $passtype["md5"] = get_string("md5", "auth");

196 $passtype["sha1"] = get_string("sha1", "auth");

197 $passtype["saltedcrypt"] = get_string("auth_dbsaltedcrypt", "auth_db");

198 $passtype["internal"] = get_string("internal", "auth");

ConsumerTest.php (https://bitbucket.org/Dal-Papa/is-340-publish-base.git) PHP · 280 lines

1 <?php

2 /**

3 * Zend Framework

21 */

22

23 require_once 'Zend/Oauth/Consumer.php';

24

25 /**

31 * @group Zend_Oauth

32 */

33 class Zend_Oauth_ConsumerTest extends PHPUnit_Framework_TestCase

34 {

35

56 {

57 $options = array(

58 'signatureMethod' => 'rsa-sha1'

59 );

60 $consumer = new Zend_Oauth_Consumer($options);

EntitySource.php (https://github.com/hpgihan/cronus.git) PHP · 273 lines

1 <?php

2

3 /**

4 * Class for loading metadata from files and URLs.

5 *

6 * @package simpleSAMLphp

7 * @version $Id$

8 */

99 $this->certificate = $config->getString('cert', NULL);

100

101 $this->cacheId = sha1($this->url);

102 $this->cacheTag = sha1(serialize($config));

121 var_export($context['ssl']['cafile'], TRUE));

122 $context['ssl']['verify_peer'] = TRUE;

123 $context['ssl']['CN_match'] = parse_url($this->url, PHP_URL_HOST);

124 }

125

OAuthService.java (https://github.com/jasphior/bandhu.git) Java · 305 lines

15 import com.sun.jersey.api.client.WebResource;

16 import com.sun.jersey.oauth.client.OAuthClientFilter;

17 import com.sun.jersey.oauth.signature.HMAC_SHA1;

18 import com.sun.jersey.oauth.signature.OAuthParameters;

19 import com.sun.jersey.oauth.signature.OAuthSecrets;

162

163 OAuthParameters params = oAuthRequest.parameters()

164 .signatureMethod(HMAC_SHA1.NAME).timestamp().nonce().version();

165 params.consumerKey(getOAuthConsumer().getKey());

166

portfolio_caller_test.php (https://github.com/markn86/moodle.git) PHP · 255 lines

1 <?php

2 // This file is part of Moodle - http://moodle.org/

3 //

27

28 global $CFG;

29 require_once($CFG->dirroot . '/mod/assign/locallib.php');

30 require_once($CFG->dirroot . '/group/lib.php');

73 $caller->set('user', $user);

74 $caller->load_data();

75 $this->assertEquals($file->get_contenthash(), $caller->get_sha1_file());

76

77 // This processes the file either by fileid or by other fields in the file table.

87 $caller->set('user', $user);

88 $caller->load_data();

89 $this->assertEquals($file->get_contenthash(), $caller->get_sha1_file());

90 }

91

Account.php (https://github.com/fan3750060/wpcore.git) PHP · 387 lines

1 <?php

2 namespace app\Common;

3

202 $data = [

203 'username' => $param['username'],

204 'sha_pass_hash' => strtoupper(sha1($param['username'] . ':' . $param['password'])),

205 'joindate' => date('Y-m-d H:i:s'),

206 'expansion' => env('EXPANSION',1),

Attribute.php (https://bitbucket.org/saifshuvo/zf2.git) PHP · 372 lines

1 <?php

2 /**

3 * Zend Framework (http://framework.zend.com/)

257 return $password;

258 case self::PASSWORD_HASH_SSHA:

259 $salt = substr(sha1(uniqid(mt_rand(), true), true), 0, 4);

260 $rawHash = sha1($password . $salt, true) . $salt;

262 break;

263 case self::PASSWORD_HASH_SHA:

264 $rawHash = sha1($password, true);

265 $method = '{SHA}';

266 break;

267 case self::PASSWORD_HASH_SMD5:

268 $salt = substr(sha1(uniqid(mt_rand(), true), true), 0, 4);

269 $rawHash = md5($password . $salt, true) . $salt;

270 $method = '{SMD5}';

post.php (https://github.com/GunioRobot/Loggix.git) PHP · 186 lines

1 <?php

2 /**

3 * Post Comment Controller

13 */

14 $pathToIndex = '../..';

15 require_once $pathToIndex . '/lib/Loggix/Module/Comment.php';

16

17 $app = new Loggix_Module_Comment;

63

64 $userName = $_POST['user_name'];

65 $userPass = sha1($_POST['user_pass']);

66 $referId = intval($_POST['refer_id']);

67 $parentKey = intval($_POST['parent_key']);

82

83 if ($checkRow > 1) {

84 header('Location: ' . $pathToIndex . '/index.php?id=' . $referId . '#comments');

85 exit;

86 }

session.php (https://gitlab.com/webkod3r/tripolis) PHP · 440 lines

1 <?php

2 /**

3 * Abstract class for managing user session tokens.

62 */

63 final private function hash_token( $token ) {

64 // If ext/hash is not present, use sha1() instead.

65 if ( function_exists( 'hash' ) ) {

66 return hash( 'sha256', $token );

67 } else {

68 return sha1( $token );

69 }

70 }

smarty_internal_cacheresource_file.php (https://gitlab.com/adamlwalker/generatedata) PHP · 264 lines

1 <?php

2 /**

3 * Smarty Internal Plugin CacheResource File

59 $_lock_dir = $_cache_dir;

60 }

61 $cached->lock_id = $_lock_dir.sha1($_cache_id.$_compile_id.$_template->source->uid).'.lock';

62 }

63 $cached->filepath = $_cache_dir . $_cache_id . $_compile_id . $_filepath . '.' . basename($_source_file_path) . '.php';

161 }

162 if (isset($_templateId[150])) {

163 $_templateId = sha1($_templateId);

164 }

165 unset($smarty->template_objects[$_templateId]);

228 public function hasLock(Smarty $smarty, Smarty_Template_Cached $cached)

229 {

230 if (version_compare(PHP_VERSION, '5.3.0', '>=')) {

231 clearstatcache(true, $cached->lock_id);

232 } else {

smarty_internal_cacheresource_file.php (https://github.com/GuessWho/don-t-enter.git) PHP · 259 lines

1 <?php

2 /**

3 * Smarty Internal Plugin CacheResource File

59 $_lock_dir = $_cache_dir;

60 }

61 $cached->lock_id = $_lock_dir.sha1($_cache_id.$_compile_id.$_template->source->uid).'.lock';

62 }

63 $cached->filepath = $_cache_dir . $_cache_id . $_compile_id . $_filepath . '.' . basename($_source_file_path) . '.php';

159 $_resourcename_parts = basename(str_replace('^', '/', $tpl->cached->filepath));

160 // remove from template cache

161 unset($smarty->template_objects[sha1(join(DIRECTORY_SEPARATOR, $smarty->getTemplateDir()).$tpl->template_resource . $tpl->cache_id . $tpl->compile_id)]);

162 } else {

163 // remove from template cache

164 unset($smarty->template_objects[sha1(join(DIRECTORY_SEPARATOR, $smarty->getTemplateDir()).$tpl->template_resource . $tpl->cache_id . $tpl->compile_id)]);

165 return 0;

166 }

complete.php (https://gitlab.com/blueprintmrk/bladencountyrecords) PHP · 206 lines

1 <?php

2 require( 'common.php' );

13

14 $partial = stripslashes( $_POST['partial'] );

15 if ( hash_hmac( 'sha1', $partial, $secret ) != $_POST['signature'] ) {

16 return;

17 }

111 return $m;

112 } else if ( preg_match( '#^:set #', $string ) ) {

113 foreach ( PHP_Shell_Options::getInstance()->getOptions() as $v ) {

114 $m[] = $v;

115 }

140 }

141

142 /* taken from http://de3.php.net/manual/en/reserved.php */

143 $m[] = 'abstract';

144 $m[] = 'and';

Remember.php (https://bitbucket.org/myockey/clearcreek-chapel-website.git) PHP · 328 lines

1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

2

3 /**

270 protected function _generate_id()

271 {

272 return sha1(uniqid(mt_rand(), TRUE));

273 }

274

325

326

327 /* End of file Remember.php */

328 /* Location: ./system/expressionengine/libraries/Remember.php */

worktree.c (https://gitlab.com/181gaming/git) C · 303 lines

55

56 /**

57 * Add the head_sha1 and head_ref (if not detached) to the given worktree

58 */

59 static void add_head_info(struct strbuf *head_ref, struct worktree *worktree)

61 if (head_ref->len) {

62 if (worktree->is_detached) {

63 get_sha1_hex(head_ref->buf, worktree->head_sha1);

64 } else {

65 resolve_ref_unsafe(head_ref->buf, 0, worktree->head_sha1, NULL);

sfOAuth1.class.php (https://github.com/edse/Elastball.git) PHP · 383 lines

1 <?php

2 /**

3 *

123

124 $request = OAuthRequest::from_consumer_and_token($this->getConsumer(), $this->getToken('oauth'), 'POST', $this->getRequestTokenUrl(), $this->getRequestParameters());

125 $request->sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $this->getConsumer(), $this->getToken('oauth'));

126

127 $params = OAuthUtil::parse_parameters($this->call($this->getRequestTokenUrl(), $request->to_postdata()));

160

161 /**

162 * (non-PHPdoc)

163 * @see plugins/sfDoctrineOAuthPlugin/lib/sfOAuth::requestAuth()

164 */

198

199 /**

200 * (non-PHPdoc)

201 * @see plugins/sfDoctrineOAuthPlugin/lib/sfOAuth::getAccessToken()

202 */

model.rb (https://github.com/globetrotter/derdiedas.git) Ruby · 142 lines

1 require 'digest/sha1'

2 class <%= class_name %> < ActiveRecord::Base

3 # Virtual attribute for the unencrypted password

72 # Encrypts some data with the salt.

73 def self.encrypt(password, salt)

74 Digest::SHA1.hexdigest("--#{salt}--#{password}--")

75 end

76

118 def encrypt_password

119 return if password.blank?

120 self.salt = Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{login}--") if new_record?

121 self.crypted_password = encrypt(password)

122 end

128 def make_activation_code

129 <% if options[:stateful] %> self.deleted_at = nil<% end %>

130 self.activation_code = Digest::SHA1.hexdigest( Time.now.to_s.split(//).sort_by {rand}.join )

131 end<% end %>

132 <% if options[:stateful] %>

Component.php (https://gitlab.com/jjpa2018/dashboard) PHP · 296 lines

1 <?php

2

3 namespace Illuminate\View;

101 );

102

103 if (! is_file($viewFile = $directory.'/'.sha1($contents).'.blade.php')) {

104 if (! is_dir($directory)) {

105 mkdir($directory, 0755, true);

109 }

110

111 return '__components::'.basename($viewFile, '.blade.php');

112 }

113

certificate_helper.rb (https://gitlab.com/gaveen/omnibus-gitlab) Ruby · 159 lines

61 files = Dir[File.join(@trusted_certs_dir, "*")]

62 files_modification_time = files.map { |name| File.stat(name).mtime if valid?(name) }

63 Digest::SHA1.hexdigest(files_modification_time.join)

64 end

65

PostImageHandler.php (https://gitlab.com/wubbajack/insided-test) PHP · 288 lines

1 <?php namespace App\Core\Handlers;

2

3 use Intervention\Image\Constraint;

250 }

251

252 return hash('sha1', $prefix . microtime() . $file->getBasename()) . $extension;

253 }

254

security.php (https://github.com/tsep/tsep1.git) PHP · 191 lines

1 <?php

2 /**

3 * Core Security

5 * PHP versions 4 and 5

6 *

7 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)

8 * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)

9 *

12 *

13 * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)

14 * @link http://cakephp.org CakePHP(tm) Project

15 * @package cake

16 * @subpackage cake.cake.libs

17 * @since CakePHP(tm) v .0.10.0.1233

18 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)

testp11.h (https://github.com/uukuguy/UDSOnlineEditor.git) C Header · 94 lines

40 } Rsa_Cert;

41

42 extern CK_MECHANISM mechRsaPkcs, mechRsaOaep, mechRsaX509, mechRsaX931, mechMd5RsaPkcs, mechSha1RsaPkcs;

43 extern unsigned char trueValue, falseValue, Rsa_e_f4[3], zeroIv[], testP12[2386];

44 extern unsigned expectCkr, ckoPubKey, ckoPrivKey, ckoCertificate, ckoSecretKey, ckcX509, ckkRsa;

51 int Template_Int( CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount, int attrType, int defaultValue );

52 void T11_CopyTemplate( CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount, CK_ATTRIBUTE_PTR pTarget, CK_ULONG maxCount );

53 CK_RV T11_GenKeyPair( CK_SESSION_HANDLE hSession, char *id, char inToken, char isExch, CK_OBJECT_HANDLE *phPubKey, CK_OBJECT_HANDLE *phPrivKey );

54 CK_RV T11_GenerateKey( CK_SESSION_HANDLE hSession, int ckk, char inToken, CK_OBJECT_HANDLE *phKey );

55 unsigned long T11_FindKey( CK_SESSION_HANDLE hSession, char isPrivate, int ckaType, unsigned char *data, int size );

index.markdown (https://gitlab.com/orvi2014/phpjs) Markdown · 180 lines

15 A JavaScript equivalent of PHP's sha1

16

17 {% codeblock strings/sha1.js lang:js https://raw.github.com/kvz/phpjs/master/functions/strings/sha1.js raw on github %}

18 function sha1(str) {

19 // discuss at: http://phpjs.org/functions/sha1/

20 // original by: Webtoolkit.info (http://www.webtoolkit.info/)

21 // improved by: Michael White (http://getsprink.com)

166 - [Raw function on GitHub](https://github.com/kvz/phpjs/blob/master/functions/strings/sha1.js)

167

168 Please note that php.js uses JavaScript objects as substitutes for PHP arrays, they are

169 the closest match to this hashtable-like data structure.

170

174 Do you have one? Then please just:

175

176 - [Edit on GitHub](https://github.com/kvz/phpjs/edit/master/functions/strings/sha1.js)

177

178

2014-05-20-how-to-use-runabove-api.markdown (https://gitlab.com/billyprice1/knowledge-base) Markdown · 86 lines

69 With this information, you can calculate the difference between timestamps and add it on your local timestamp on each request.

70

71 Signature is a sha1, in hexadecimal format, composed by a string with some information separated by _+_ character: your application secret, the consumer key, HTTP verb, query, body of the request and timestamp.

72

73 ```bash

74 $ echo -n "your_application_secret_key+application_consumer_key+GET+https://api.runabove.com/1.0/instance++1400000000" | openssl dgst -sha1 | awk '{print $2}'

75 d33fced42c337a8dfc15d6b7a8e0c588d3a0f62f

76 ```

CryptSha1.c (https://gitlab.com/envieidoc/Clover) C · 184 lines

89 // Check input parameters.

90 //

91 if (Sha1Context == NULL || NewSha1Context == NULL) {

92 return FALSE;

93 }

141 // OpenSSL SHA-1 Hash Update

142 //

143 return (BOOLEAN) (SHA1_Update ((SHA_CTX *) Sha1Context, Data, DataSize));

144 }

145

181 // OpenSSL SHA-1 Hash Finalization

182 //

183 return (BOOLEAN) (SHA1_Final (HashValue, (SHA_CTX *) Sha1Context));

184 }

185

rsa-sign.js (https://github.com/lloyd/jwcrypto.git) JavaScript · 155 lines

15 //

16 // Depends on:

17 // function sha1.hex(s) of sha1.js

18 // jsbn.js

19 // jsbn2.js

37 //_RSASIGN_DIHEAD['sha512'] = "3051300d060960864801650304020305000440";

38 var _RSASIGN_HASHHEXFUNC = [];

39 _RSASIGN_HASHHEXFUNC['sha1'] = sha1.hex;

40 _RSASIGN_HASHHEXFUNC['sha256'] = sha256.hex;

41

148

149 RSAKey.prototype.signString = _rsasign_signString;

150 RSAKey.prototype.signStringWithSHA1 = _rsasign_signStringWithSHA1;

151 RSAKey.prototype.signStringWithSHA256 = _rsasign_signStringWithSHA256;

152

Sha1Ed2kSettingsPanel.java (https://github.com/ioerror/OneSwarm.git) Java · 156 lines

15 import edu.washington.cs.oneswarm.ui.gwt.rpc.StringTools;

16

17 public class Sha1Ed2kSettingsPanel extends SettingsPanel {

18 TextBox speed_box = new TextBox();

19 Label tempLocationLabel = new Label("...");

22 protected String mTempSaveLocation;

23

24 public Sha1Ed2kSettingsPanel() {

25 speed_box.setText("...");

26 HorizontalPanel p = new HorizontalPanel();

38

39 OneSwarmRPCClient.getService().getIntegerParameterValue(OneSwarmRPCClient.getSessionID(),

40 "oneswarm.max.sha1.hash.rate.kbps", new AsyncCallback<Integer>() {

41 public void onFailure(Throwable caught) {

42 caught.printStackTrace();

adapter.php (https://github.com/cebe/atoum.git) PHP · 348 lines

1 <?php

2

3 namespace mageekguy\atoum\tests\units\test;

7 ;

8

9 require_once(__DIR__ . '/../../runner.php');

10

11 class adapter extends atoum\test

231

232 $otherAdapter = new atoum\test\adapter();

233 $otherAdapter->sha1(uniqid());

234

235 $this->assert

test_negotiation.py (https://github.com/ziima/python-openid.git) Python · 285 lines

124 msg.setArg(OPENID_NS, 'error', 'Unsupported type')

125 msg.setArg(OPENID_NS, 'error_code', 'unsupported-type')

126 msg.setArg(OPENID_NS, 'assoc_type', 'HMAC-SHA1')

127 msg.setArg(OPENID_NS, 'session_type', 'DH-SHA1')

128

129 assoc = association.Association('handle', b'secret', 'issued', 10000, 'HMAC-SHA1')

130

131 self.consumer.return_messages = [msg, assoc]

142 msg.setArg(OPENID_NS, 'error', 'Unsupported type')

143 msg.setArg(OPENID_NS, 'error_code', 'unsupported-type')

144 msg.setArg(OPENID_NS, 'assoc_type', 'HMAC-SHA1')

145 msg.setArg(OPENID_NS, 'session_type', 'DH-SHA1')

159 first attempt to get one.

160 """

161 assoc = association.Association('handle', b'secret', 'issued', 10000, 'HMAC-SHA1')

162

163 self.consumer.return_messages = [assoc]

UuidFactory.php (https://gitlab.com/dcyar/webservice) PHP · 292 lines

1 <?php

2 /**

3 * This file is part of the ramsey/uuid library

227 public function uuid5($ns, $name)

228 {

229 return $this->uuidFromNsAndName($ns, $name, 5, 'sha1');

230 }

231

user.php (https://github.com/joshbatchelor/Dingo-Framework.git) PHP · 611 lines

1 <?php if(!defined('DINGO')){die('External Access to File Denied');}

2

3 /**

414 public static function hash($i)

415 {

416 return sha1($i);

417 }

418 }

565 public function hash($i)

566 {

567 return sha1($i);

568 }

569 }

g2apay.php (https://bitbucket.org/mmahdy/opencart-modules-app.git) PHP · 302 lines

1 <?php

2

3 class ControllerExtensionPaymentG2APay extends Controller {

145 $data['payment_g2apay_secret_token'] = $this->config->get('payment_g2apay_secret_token');

146 } else {

147 $data['payment_g2apay_secret_token'] = sha1(uniqid(mt_rand(), 1));

148 }

149

150 $data['g2apay_ipn_url'] = HTTPS_CATALOG . 'index.php?route=extension/payment/g2apay/ipn&token=' . $data['payment_g2apay_secret_token'];

151

152 if (isset($this->request->post['payment_g2apay_ipn_uri'])) {

hwcap.h (https://gitlab.com/dieselnutjob/linux-next) C Header · 134 lines

35 #define COMPAT_HWCAP2_AES (1 << 0)

36 #define COMPAT_HWCAP2_PMULL (1 << 1)

37 #define COMPAT_HWCAP2_SHA1 (1 << 2)

38 #define COMPAT_HWCAP2_SHA2 (1 << 3)

39 #define COMPAT_HWCAP2_CRC32 (1 << 4)

58 #define KERNEL_HWCAP_AES __khwcap_feature(AES)

59 #define KERNEL_HWCAP_PMULL __khwcap_feature(PMULL)

60 #define KERNEL_HWCAP_SHA1 __khwcap_feature(SHA1)

61 #define KERNEL_HWCAP_SHA2 __khwcap_feature(SHA2)

62 #define KERNEL_HWCAP_CRC32 __khwcap_feature(CRC32)

63 #define KERNEL_HWCAP_ATOMICS __khwcap_feature(ATOMICS)

64 #define KERNEL_HWCAP_FPHP __khwcap_feature(FPHP)

65 #define KERNEL_HWCAP_ASIMDHP __khwcap_feature(ASIMDHP)

66 #define KERNEL_HWCAP_CPUID __khwcap_feature(CPUID)

RedisTaggedCache.php (https://gitlab.com/madwanz64/laravel) PHP · 198 lines

1 <?php

2

3 namespace Illuminate\Cache;

126 protected function pushKeys($namespace, $key, $reference)

127 {

128 $fullKey = $this->store->getPrefix().sha1($namespace).':'.$key;

129

130 foreach (explode('|', $namespace) as $segment) {

user.rb (https://github.com/larssg/score-keeper.git) Ruby · 155 lines

1 require 'digest/sha1'

2 class User < ActiveRecord::Base

3 # Virtual attribute for the unencrypted password

70 # Encrypts some data with the salt.

71 def self.encrypt(password, salt)

72 Digest::SHA1.hexdigest("--#{salt}--#{password}--")

73 end

74

145

146 if new_record?

147 self.salt = Digest::SHA1.hexdigest("--#{Time.now}--#{login}--")

148 end

149 self.crypted_password = encrypt(password)

MapImage.php (https://github.com/FaigerSYS/MapImageEngine.git) PHP · 292 lines

1 <?php

2 namespace FaigerSYS\MapImageEngine\storage;

3

209 */

210 public function getHashedUUID() : string {

211 return hash('sha1', $this->uuid->toBinary());

212 }

213

Basic.php (https://github.com/dswalker/xerxes.git) PHP · 214 lines

1 <?php

2

3 /*

14 use Xerxes\Utility\Parser;

15

16 require_once __DIR__ . '/../OAuth/OAuth.php'; // @todo: make this not hardwired

17

18 /**

62 $server = new \OAuthServer( $store );

63

64 $method = new \OAuthSignatureMethod_HMAC_SHA1();

65 $server->add_signature_method( $method );

66

mysql.sql (https://github.com/wangaiying/elgg4ysu.git) SQL · 219 lines

4 # I have commented the constraints out, just look for 'usa_id_ref' to enable them.

5 #

6 # The --SPLIT-- markers are used by the install.php script

7 #

8 # @version $Id: mysql.sql 51 2008-10-15 15:15:47Z marcw@pobox.com $

78 ocr_consumer_key varchar(64) binary not null,

79 ocr_consumer_secret varchar(64) binary not null,

80 ocr_signature_methods varchar(255) not null default 'HMAC-SHA1,PLAINTEXT',

81 ocr_server_uri varchar(255) not null,

82 ocr_server_uri_host varchar(128) not null,

sha1_glue.c (https://gitlab.com/kush/linux) C · 184 lines

1 /* Glue code for SHA1 hashing optimized for sparc64 crypto opcodes.

2 *

3 * This is based largely upon arch/x86/crypto/sha1_ssse3_glue.c

33 *sctx = (struct sha1_state){

34 .state = { SHA1_H0, SHA1_H1, SHA1_H2, SHA1_H3, SHA1_H4 },

35 };

36

38 }

39

40 static void __sha1_sparc64_update(struct sha1_state *sctx, const u8 *data,

41 unsigned int len, unsigned int partial)

42 {

178

179 MODULE_LICENSE("GPL");

180 MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm, sparc64 sha1 opcode accelerated");

181

182 MODULE_ALIAS_CRYPTO("sha1");

smarty_internal_resource_registered.php (https://github.com/ACCORD5/TrellisDesk.git) PHP · 137 lines

1 <?php

2

3 /**

51 // return "string" for compiler error messages

52 $_filepath = $_template->resource_type .':'.$_template->resource_name;

53 $_template->templateUid = sha1($_filepath);

54 return $_filepath;

55 }

131 $_compile_dir .= DS;

132 }

133 return $_compile_dir . $_filepath . '.' . $_template->resource_type . '.' . basename($_template->resource_name) . $_cache . '.php';

134 }

135 }

AbstractStorage.php (https://github.com/knutBachmann/zf2.git) PHP · 136 lines

1 <?php

2

3 /**

43 * @param string $url OpenID server URL

44 * @param string $handle assiciation handle

45 * @param string $macFunc HMAC function (sha1 or sha256)

46 * @param string $secret shared secret

47 * @param long $expires expiration UNIX time

57 * @param string $url OpenID server URL

58 * @param string &$handle assiciation handle

59 * @param string &$macFunc HMAC function (sha1 or sha256)

60 * @param string &$secret shared secret

61 * @param long &$expires expiration UNIX time

71 * @param string $handle assiciation handle

72 * @param string &$url OpenID server URL

73 * @param string &$macFunc HMAC function (sha1 or sha256)

74 * @param string &$secret shared secret

75 * @param long &$expires expiration UNIX time

orm.php (https://github.com/jimktrains/kohana-auth.git) PHP · 300 lines

1 <?php defined('SYSPATH') or die('No direct access allowed.');

2 /**

3 * ORM Auth driver.

203 if ($token->loaded() AND $token->user->loaded())

204 {

205 if ($token->user_agent === sha1(Request::$user_agent))

206 {

207 // Save the token to create a new unique token

Crypt.php (https://bitbucket.org/DragonBe/zfform.git) PHP · 168 lines

1 <?php

2 /**

3 * Zend Framework

44 'rmd160',

45 'sha',

46 'sha1',

47 'sha224',

48 'sha256',

66 'md5',

67 'ripemd160',

68 'sha1',

69 'sha256',

70 'tiger',

121 * @see Zend_Crypt_Exception

122 */

123 require_once 'Zend/Crypt/Exception.php';

124 throw new Zend_Crypt_Exception('\'' . $algorithm . '\' is not supported by any available extension or native function');

125 }

Crypt.php (https://gitlab.com/vincent.perdereau/picandparts) PHP · 168 lines

1 <?php

2 /**

3 * Zend Framework

44 'rmd160',

45 'sha',

46 'sha1',

47 'sha224',

48 'sha256',

66 'md5',

67 'ripemd160',

68 'sha1',

69 'sha256',

70 'tiger',

121 * @see Zend_Crypt_Exception

122 */

123 #require_once 'Zend/Crypt/Exception.php';

124 throw new Zend_Crypt_Exception('\'' . $algorithm . '\' is not supported by any available extension or native function');

125 }

math-fallback.php (https://gitlab.com/juanito.abelo/nlmobile) PHP · 113 lines

57 ob_start();

58 ?>

59 <h2><?php _e( 'Please solve this math problem to prove that you are not a bot. Once you solve it, you will need to log in again.', 'jetpack' ); ?></h2>

60 <?php if ($error): ?>

64 <form action="<?php echo home_url(); ?>" method="post" accept-charset="utf-8">

65 <?php Jetpack_Protect_Math_Authenticate::math_form(); ?>

66 <input type="hidden" name="jetpack_protect_process_math_form" value="1" id="jetpack_protect_process_math_form" />

67 <p><input type="submit" value="Continue &rarr;"></p>

82 Jetpack_Protect_Math_Authenticate::generate_math_page(true);

83 } else {

84 $temp_pass = substr( sha1( rand( 1, 100000000 ) . get_site_option( 'jetpack_protect_key' ) ), 5, 25 );

85 Jetpack_Protect_Module::set_transient( 'jpp_math_pass_' . $temp_pass, 3, DAY_IN_SECONDS );

86 setcookie('jpp_math_pass', $temp_pass, time() + DAY_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN, false);

103 <div style="margin: 5px 0 20px;">

104 <strong>Prove your humanity: </strong>

105 <?php echo $num1 ?> &nbsp; + &nbsp; <?php echo $num2 ?> &nbsp; = &nbsp;

106 <input type="input" name="jetpack_protect_num" value="" size="2" />

107 <input type="hidden" name="jetpack_protect_answer" value="<?php echo $ans; ?>" />

Component.php (https://github.com/ladybirdweb/agorainvoicing.git) PHP · 276 lines

1 <?php

2

3 namespace Illuminate\View;

95 );

96

97 if (! file_exists($viewFile = $directory.'/'.sha1($contents).'.blade.php')) {

98 if (! is_dir($directory)) {

99 mkdir($directory, 0755, true);

103 }

104

105 return '__components::'.basename($viewFile, '.blade.php');

106 }

107

Crypt.php (https://bitbucket.org/Ebozavrik/test-application.git) PHP · 176 lines

1 <?php

2 /**

3 * Zend Framework

17 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)

18 * @license http://framework.zend.com/license/new-bsd New BSD License

19 * @version $Id: Crypt.php 25024 2012-07-30 15:08:15Z rob $

20 */

21

44 'rmd160',

45 'sha',

46 'sha1',

47 'sha224',

48 'sha256',

66 'md5',

67 'ripemd160',

68 'sha1',

69 'sha256',

70 'tiger',

forgotten.php (https://bitbucket.org/deringer/opencart.git) PHP · 121 lines

1 <?php

2 class ControllerAccountForgotten extends Controller {

3 private $error = array();

17 $this->language->load('mail/forgotten');

18

19 $password = substr(sha1(uniqid(mt_rand(), true)), 0, 10);

20

21 $this->model_account_customer->editPassword($this->request->post['email'], $password);

user.php (https://bitbucket.org/mjalajel/opencart.git) PHP · 101 lines

2 class ModelUserUser extends Model {

3 public function addUser($data) {

4 $this->db->query("INSERT INTO `" . DB_PREFIX . "user` SET username = '" . $this->db->escape($data['username']) . "', user_group_id = '" . (int)$data['user_group_id'] . "', salt = '" . $this->db->escape($salt = substr(md5(uniqid(rand(), true)), 0, 9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1($data['password'])))) . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', image = '" . $this->db->escape(html_entity_decode($data['image'], ENT_QUOTES, 'UTF-8')) . "', status = '" . (int)$data['status'] . "', date_added = NOW()");

5 }

6

9

10 if ($data['password']) {

11 $this->db->query("UPDATE `" . DB_PREFIX . "user` SET salt = '" . $this->db->escape($salt = substr(md5(uniqid(rand(), true)), 0, 9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1($data['password'])))) . "' WHERE user_id = '" . (int)$user_id . "'");

12 }

13 }

14

15 public function editPassword($user_id, $password) {

16 $this->db->query("UPDATE `" . DB_PREFIX . "user` SET salt = '" . $this->db->escape($salt = substr(md5(uniqid(rand(), true)), 0, 9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1($password)))) . "', code = '' WHERE user_id = '" . (int)$user_id . "'");

17 }

18

Asset.php (https://github.com/jasteele12/concrete5.git) PHP · 425 lines

1 <?php

2 namespace Concrete\Core\Asset;

3

151 if (is_file($filename)) {

152 if (is_readable($filename) && \Config::get('concrete.cache.full_contents_assets_hash')) {

153 $sha1 = @sha1_file($filename);

154 if ($sha1 !== false) {

155 $result = $sha1;

156 }

157 } else {

RevisionTest.php (https://gitlab.com/link233/bootmw) PHP · 493 lines

1 <?php

2

3 /**

71 */

72 public function testGetRevisionTextGzip() {

73 $this->checkPHPExtension( 'zlib' );

74

75 $row = new stdClass;

111 */

112 public function testGetRevisionTextUtf8NativeGzip() {

113 $this->checkPHPExtension( 'zlib' );

114

115 $row = new stdClass;

126 */

127 public function testGetRevisionTextUtf8LegacyGzip() {

128 $this->checkPHPExtension( 'zlib' );

129

130 $row = new stdClass;

Runs.php (https://github.com/omegaup/omegaup.git) PHP · 213 lines

1 <?php

2 /** ************************************************************************ *

3 * !ATENCION! *

136

137 /**

138 * El hash SHA1 del árbol de la rama private.

139 *

140 * @var string|null

143

144 /**

145 * El hash SHA1 del commit en la rama master del problema con el que se realizó el envío.

146 *

147 * @var string|null

RepoConstants.java (https://gitlab.com/Codeaurora/platform_sdk) Java · 158 lines

6 * You may obtain a copy of the License at

7 *

8 * http://www.eclipse.org/org/documents/epl-v10.php

9 *

10 * Unless required by applicable law or agreed to in writing, software

87 /** An archive size, an int > 0. */

88 public static final String NODE_SIZE = "size"; //$NON-NLS-1$

89 /** A sha1 archive checksum, as a 40-char hex. */

90 public static final String NODE_CHECKSUM = "checksum"; //$NON-NLS-1$

91 /** A download archive URL, either absolute or relative to the repository xml. */

106 /** Type of a sha1 checksum. */

107 public static final String SHA1_TYPE = "sha1"; //$NON-NLS-1$

108

109 /** Length of a string representing a SHA1 checksum; always 40 characters long. */

110 public static final int SHA1_CHECKSUM_LEN = 40;

111

112 /**

database.php (https://github.com/kunalghosh/OwnCloud.git) PHP · 180 lines

1 <?php

2

3 /**

34 */

35

36 require_once 'phpass/PasswordHash.php';

37

38 /**

129 if($row){

130 $storedHash=$row['password'];

131 if (substr($storedHash,0,1)=='$'){//the new phpass based hashing

132 $hasher=$this->getHasher();

133 if($hasher->CheckPassword($password, $storedHash)){

136 return false;

137 }

138 }else{//old sha1 based hashing

139 if(sha1($password)==$storedHash){

RevisionInfoFactory.java (https://github.com/jenkinsci/git-parameter-plugin.git) Java · 119 lines

48 for (ObjectId objectId : objectIds) {

49 Revision revision = new Revision(objectId);

50 revisionInfoList.add(new RevisionInfo(revision.getSha1String(), prettyRevisionInfo(revision)));

51 }

52

55

56 private String prettyRevisionInfo(Revision revision) {

57 String shortSha1 = revision.getSha1String().substring(0, 8);

58

59 List<String> raw;

60 try {

61 raw = gitClient.showRevision(revision.getSha1());

62 } catch (GitException | InterruptedException e1) {

63 LOGGER.log(Level.SEVERE, Messages.GitParameterDefinition_unexpectedError(), e1);

Crypto.java (https://gitlab.com/KiaraGrouwstra/playframework) Java · 203 lines

17 * For more information about cryptography, we recommend reading the OWASP Cryptographic Storage Cheatsheet:

18 *

19 * https://www.owasp.org/index.php/Cryptographic_Storage_Cheat_Sheet

20 */

21 @Singleton

30

31 /**

32 * Signs the given String with HMAC-SHA1 using the given key.

33 * <br>

34 * By default this uses the platform default JSSE provider. This can be overridden by defining

44

45 /**

46 * Signs the given String with HMAC-SHA1 using the application's secret key.

47 * <br>

48 * By default this uses the platform default JSSE provider. This can be overridden by defining

ValidateResponseChecksumParser.php (https://github.com/ocStore/ocStore.git) PHP · 149 lines

1 <?php

2 namespace Aws\S3;

3

58

59 if (extension_loaded('awscrt')) {

60 $checksumPriority = ['CRC32C', 'CRC32', 'SHA1', 'SHA256'];

61 } else {

62 $checksumPriority = ['CRC32', 'SHA1', 'SHA256'];

smarty_cacheresource_custom.php (https://bitbucket.org/mrajoelisolo/ci_smarty.git) PHP · 237 lines

1 <?php

2 /**

3 * Smarty Internal Plugin

82 $_compile_id = isset($cached->compile_id) ? preg_replace('![^\w\|]+!', '_', $cached->compile_id) : null;

83

84 $cached->filepath = sha1($cached->source->filepath . $_cache_id . $_compile_id);

85 $this->populateTimestamp($cached);

86 }

smarty_internal_cacheresource_file.php (https://github.com/taptouchclick/The-Event-Day.git) PHP · 207 lines

1 <?php

2

3 /**

54 $_cache_dir .= DS;

55 }

56 return $_cache_dir . $_cache_id . $_compile_id . $_filepath . '.' . basename($_source_file_path) . '.php';

57 }

58

150 $_resourcename_parts = basename(str_replace('^', '/', $tpl->getCachedFilepath()));

151 // remove from template cache

152 unset($this->smarty->template_objects[sha1($tpl->template_resource . $tpl->cache_id . $tpl->compile_id)]);

153 } else {

154 // remove from template cache

155 unset($this->smarty->template_objects[sha1($tpl->template_resource . $tpl->cache_id . $tpl->compile_id)]);

156 return 0;

157 }

DoctrineAclCache.php (https://github.com/nattaphat/hgis.git) PHP · 223 lines

1 <?php

2

3 /*

207 private function getDataKeyByIdentity(ObjectIdentityInterface $oid)

208 {

209 return $this->prefix.md5($oid->getType()).sha1($oid->getType())

210 .'_'.md5($oid->getIdentifier()).sha1($oid->getIdentifier());

Google2FA.php (https://gitlab.com/jjpa2018/dashboard) PHP · 495 lines

1 <?php

2

3 namespace PragmaRX\Google2FA;

19 * @var string

20 */

21 protected $algorithm = Constants::SHA1;

22

23 /**

201 {

202 return [

203 Constants::SHA1,

204 Constants::SHA256,

205 Constants::SHA512,

281

282 /**

283 * Extracts the OTP from the SHA1 hash.

284 *

285 * @param string $hash

Sha1Test.php (https://github.com/zucchi/zf2.git) PHP · 183 lines

95 $validator = new File\Sha1(array('12345', '12333', '12344'));

96 $this->assertEquals(array('12345' => 'sha1', '12333' => 'sha1', '12344' => 'sha1'), $validator->getSha1());

97 }

98

138

139 $validator->setHash(array('12321', '12121'));

140 $this->assertEquals(array('12321' => 'sha1', '12121' => 'sha1'), $validator->getSha1());

141 }

142

154 $validator->addSha1(array('12321', '12121'));

155 $this->assertEquals(array('12345' => 'sha1', '12344' => 'sha1', '12321' => 'sha1', '12121' => 'sha1'), $validator->getSha1());

156 }

157

168

169 $validator->addHash(array('12321', '12121'));

170 $this->assertEquals(array('12345' => 'sha1', '12344' => 'sha1', '12321' => 'sha1', '12121' => 'sha1'), $validator->getSha1());

171 }

172

librejs.php (https://github.com/GoteoFoundation/goteo.git) PHP · 167 lines

1 <?php

2 $this->layout("layout", [

3 'bodyClass' => 'about',

61 </tr>

62 <tr>

63 <td><a href="<?= SRC_URL ?>/view/js/sha1.min.js">sha1.min.js</a></td>

64 <td><a href="http://opensource.org/licenses/BSD-3-Clause">BSD-3-Clause</a></td>

65 <td><a href="<?= SRC_URL ?>/view/js/sha1.js">sha1.js</a></td>

164 </div>

165

166 <?php $this->replace() ?>

167

168

ceph_crypto.cc (https://gitlab.com/unofficial-mirrors/ceph) C++ · 157 lines

61 }

62

63 TEST(HMACSHA1, Simple) {

64 ceph::crypto::HMACSHA1 h((const unsigned char*)"sekrit", 6);

65 h.Update((const unsigned char*)"foo", 3);

66 unsigned char digest[CEPH_CRYPTO_HMACSHA1_DIGESTSIZE];

67 h.Final(digest);

68 int err;

69 unsigned char want_digest[CEPH_CRYPTO_HMACSHA1_DIGESTSIZE] = {

70 0x04, 0xbc, 0x52, 0x66, 0xb6, 0xff, 0xad, 0xad, 0x9d, 0x57,

71 0xce, 0x13, 0xea, 0x8c, 0xf5, 0x6b, 0xf9, 0x95, 0x2f, 0xd6,

72 };

73 err = memcmp(digest, want_digest, CEPH_CRYPTO_HMACSHA1_DIGESTSIZE);

74 ASSERT_EQ(0, err);

75 }

SHA1Engine.cpp (https://gitlab.com/Teo-Mirror/AtomicGameEngine) C++ · 285 lines

32

33

34 SHA1Engine::SHA1Engine()

35 {

36 _digest.reserve(16);

39

40

41 SHA1Engine::~SHA1Engine()

42 {

43 reset();

45

46

47 inline void SHA1Engine::byteReverse(UInt32* buffer, int byteCount)

48 {

49 #ifdef POCO_ARCH_LITTLE_ENDIAN

WSSEUsernameToken.as (https://github.com/balintorosz/pubnub-api.git) ActionScript · 114 lines

109 internal static function getBase64Digest(nonce:String, created:String, password:String):String

110 {

111 return SHA1.hashToBase64(nonce + created + password);

112 }

113 }

cloudstack.py (https://github.com/raweng/libcloud.git) Python · 121 lines

46 signature = signature.lower().replace('+', '%20')

47 signature = hmac.new(b(self.key), msg=b(signature),

48 digestmod=hashlib.sha1)

49 return base64.b64encode(b(signature.digest()))

50

auth.php (https://github.com/cms3/cms3.git) PHP · 191 lines

1 <?php

2 /**

3 * Library Class for handling OpenID authentication.

4 *

5 * $Id: auth.php 2008-09-25 17:28:07 BST Atomless $

6 *

7 * Instantiation of this class initiates a chain of extension down to the Openid base class:

12 * @author Kohana Team

13 * @copyright (c) 2007-2008 Kohana Team

14 * @license http://kohanaphp.com/license.html

15 */

16 class Openid_Auth extends Openid_Relyingparty {

43 * Constructor.

44 *

45 * @param array - openid fields to be set in the base Openid.php class

46 * @return void

47 */

03-one-time-auth.md (https://gitlab.com/Mirros/shadowsocks-org) Markdown · 55 lines

3 By default, the server that supports OTA should run in the compatible mode. OTA is only applied if the client's request header has a flag set. However, if the server switch on OTA explicitly, all clients must switch on OTA, otherwise connections will be denied.

4

5 The authentication method is **HMAC-SHA1** which has wide supports among all major platforms and fairly good speed.

6

7 ##TCP

18 ATYP is a 8-bit char where the rightmost four bits, 0b00001111 (0xf), are reserved for address types, the flag bit of OTA is 0b00010000 (0x10). In C/C++, simply check if `ATYP & 0x10 == 1`, then OTA is enabled.

19

20 The key of HMAC-SHA1 is (IV + KEY), and the input is the whole header (not including HMAC-SHA1). The output of HMAC-SHA1 is truncated to leftmost 80 bits (10 bytes) according to [RFC 2104](https://tools.ietf.org/html/rfc2104#page-5).

21

22 ###Chunk Authentication

33 DATA.LEN is a 16-bit big-endian integer indicating the length of DATA.

34

35 The input of HMAC-SHA1 is DATA. And the key of HMAC-SHA1 is (IV + Chunk ID) where Chunk ID is an unsigned integer counted per connection from 0. In order to achieve this, both server side and client side need to keep a counter for each TCP connection. Chunk ID must be converted to big-endian before constructing the key of HMAC-SHA1.

36

37 For a client, after constructing an OTA-enabled request, the whole chunk is encrypted as a payload then sent to server-side.

edit.php (https://github.com/ichraffsnicht/ClanSphere-Enhanced.git) PHP · 136 lines

1 <?php

2 // ClanSphere 2010 - www.clansphere.net

3 // $Id$

11 if (!empty($cs_post['id'])) $board_id = $cs_post['id'];

12

13 require_once('mods/categories/functions.php');

14

15 $board_pwdel = 0;

112 if($cs_db['hash'] == 'md5')

113 $board['board_pwd'] = md5($new_board_pwd);

114 elseif($cs_db['hash'] == 'sha1')

115 $board['board_pwd'] = sha1($new_board_pwd);

MaxCDN.php (https://gitlab.com/Blueprint-Marketing/php-maxcdn) PHP · 116 lines

1 <?php

2 /**

3 * MaxCDN REST Client Library

41 $req_req = \MaxCDN\OAuth\OAuthRequest::from_consumer_and_token($this->consumer, NULL, $method_type, $endpoint, $params);

42

43 //sign your OAuth request using hmac_sha1

44 $sig_method = new \MaxCDN\OAuth\OAuthSignatureMethod_HMAC_SHA1();

75

76 //set user agent

77 curl_setopt($ch, CURLOPT_USERAGENT, 'PHP MaxCDN API Client');

78

79 // make call

User.php (https://gitlab.com/r.collas/site_central) PHP · 153 lines

1 <?php

2

3 class Controller_User extends Yab_Controller_Action {

50 $formvalue = $form->getValues() ;

51 $password = $formvalue['mdp'] ;

52 $formvalue['mdp'] = sha1(sha1($password).$password) ;

53

54 // Recupération session entiteadmin_id

100 $formvalue = $form->getValues();

101 $password = $formvalue['mdp'];

102 $formvalue['mdp'] = sha1(sha1($password).$password) ;

103

104 //Trois param($donnees, $field, $fieldMessage, $errors_messages)

Totp.php (https://github.com/Hackwar/joomla-cms.git) PHP · 207 lines

1 <?php

2 /**

3 * Joomla! Content Management System

147 $time = str_pad($time, 8, \chr(0), STR_PAD_LEFT);

148

149 $hash = hash_hmac('sha1', $time, $secret, true);

150 $offset = \ord(substr($hash, -1));

151 $offset = $offset & 0xF;

197 *

198 * @note Since 3.9.25 we use the secure method "random_bytes" over the original insecure "rand" function.

199 * The random_bytes function has been backported to outdated PHP versions by the core shipped library paragonie/random_compat

200 */

201 public function generateSecret()

User.php (https://github.com/josephwegner/holidaywish.es.git) PHP · 264 lines

1 <?php

2

3 $classBuilder['User'] = new UserModel();

235 */

236 private function encodePassword($user, $pass, $salt) {

237 $h_user = sha1($user);

238 $h_pass = md5($pass); //Mix in an md5, so if our DB ever gets cracked, it's not painfully obvious how we did hashed things.

239 $h_salt = sha1($salt);

240

241 return sha1($h_user.$h_pass.$h_salt);

242 }

243

sha1.c (https://gitlab.com/deepcypher/linux) C · 139 lines

3 * Cryptographic API.

4 *

5 * powerpc implementation of the SHA1 Secure Hash Algorithm.

6 *

7 * Derived from cryptoapi implementation, adapted for in-place

8 * scatterlist interface.

9 *

10 * Derived from "crypto/sha1.c"

11 * Copyright (c) Alan Smithee.

12 * Copyright (c) Andrew McDonald <andrew@mcdonald.org.uk>

18 #include <linux/mm.h>

19 #include <linux/types.h>

20 #include <crypto/sha1.h>

21 #include <crypto/sha1_base.h>

24 void powerpc_sha_transform(u32 *state, const u8 *src);

25

26 static int powerpc_sha1_update(struct shash_desc *desc, const u8 *data,

27 unsigned int len)

28 {

users_model.php (https://bitbucket.org/jo_racingdesign/codecms.git) PHP · 238 lines

1 <?php defined('BASEPATH') OR exit('No direct script access allowed');

2

3 /**

33 foreach ($data as $udata) {

34

35 $user_identity = array( 'identity' => sha1($udata), 'is_logged_in' => 1, 'last_login' => time($this->session->userdata('last_activity')) );

36 }

37

45

46 //CHECK IN THE DATABASE THE USERNAME AND PASSWORD COMBINATION

47 $query = $this->db->get_where('users', array( 'email' => $this->input->post('email'), 'password' => sha1($this->input->post('password')) ));

48

49 if ( $query->num_rows() == 1 ) :

BaseApplication.php (https://github.com/TYPO3/Surf.git) PHP · 223 lines

1 <?php

2

3 namespace TYPO3\Surf\Application;

83 *

84 * Update stage:

85 * - Perform Git checkout (and pass on sha1 / tag or branch option from application to the task)

86 *

87 * Switch stage:

OpenDKIMSigner.php (https://gitlab.com/shivkumarsah/shivkumarsah.com) PHP · 186 lines

1 <?php

2

3 /*

25 const CANON_RELAXED = 1;

26 const CANON_SIMPLE = 2;

27 const SIG_RSA_SHA1 = 3;

28 const SIG_RSA_SHA256 = 4;

29

33 $this->_peclLoaded = true;

34 } else {

35 throw new Swift_SwiftException('php-opendkim extension not found');

36 }

37 parent::__construct($privateKey, $domainName, $selector);

62 $bodyLen = - 1;

63 }

64 $hash = ($this->_hashAlgorithm == 'rsa-sha1') ? OpenDKIMSign::ALG_RSASHA1 : OpenDKIMSign::ALG_RSASHA256;

65 $bodyCanon = ($this->_bodyCanon == 'simple') ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED;

66 $headerCanon = ($this->_headerCanon == 'simple') ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED;

hash.rb (https://bitbucket.org/moon2l/arachni-scanner.git) Ruby · 384 lines

9 =end

10

11 require 'digest/sha1'

12

13 module Arachni

376 private

377 def eql_hash( str )

378 Digest::SHA1.hexdigest( str )

379 end

380

DSASignatureDeformatterTest.cs (https://github.com/t-ashula/mono.git) C# · 174 lines

95

96 [Test]

97 public void SetHash_SHA1 ()

98 {

99 def.SetHashAlgorithm ("SHA1");

uuidv5.js (https://gitlab.com/pump.io/pump.io) JavaScript · 119 lines

24 //

25 // Copyright (c) 2010-2012 Robert Kieffer

26 // MIT License - http://opensource.org/licenses/mit-license.php

27 //

28 // Branch for v5 UUIDs by OrangeDog

87 }

88

89 var hash = crypto.createHash("sha1");

90 hash.update(ns || "");

91 hash.update(data || "");

smarty_internal_resource_registered.php (https://gitlab.com/webbroteam/satisfaction-mvc) PHP · 99 lines

1 <?php

2 /**

3 * Smarty Internal Plugin Resource Registered

30 {

31 $source->filepath = $source->type . ':' . $source->name;

32 $source->uid = sha1($source->filepath . $source->smarty->_joined_template_dir);

33 if ($source->smarty->compile_check) {

34 $source->timestamp = $this->getTemplateTimestamp($source);

hash.php (https://github.com/tharkun/atoum.git) PHP · 128 lines

1 <?php

2

3 namespace mageekguy\atoum\tests\units\asserters;

10 ;

11

12 require_once __DIR__ . '/../../runner.php';

13

14 class hash extends atoum\test

19 }

20

21 public function testIsSha1()

22 {

23 $this

24 ->if($asserter = new asserters\hash($generator = new asserter\generator()))

25 ->and($asserter->setWith($value = hash('sha1', 'hello')))

26 ->then

27 ->object($asserter->isSha1())->isIdenticalTo($asserter)

class_loggin.php (https://github.com/KaTaLyzer/KaTaLyzer.git) PHP · 211 lines

1 <?php

2

3 class database{

177 public static function login_password_encryption($password)

178 {

179 return sha1($password);

180

181 }

Hmac.php (https://github.com/niel/lithium.git) PHP · 155 lines

1 <?php

2 /**

3 * Lithium: the most rad php framework

4 *

5 * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)

6 * @license http://opensource.org/licenses/bsd-license.php The BSD License

7 */

8

69 * @see lithium\storage\Session

70 * @see lithium\core\Adaptable::config()

71 * @link http://php.net/manual/en/function.hash-hmac.php PHP Manual: hash_hmac()

72 * @param mixed $data The data to be signed.

73 * @param array $options Options for this method.

123 * @see lithium\storage\Session

124 * @see lithium\core\Adaptable::config()

125 * @link http://php.net/manual/en/function.hash-hmac.php PHP Manual: hash_hmac()

126 * @param mixed $data The data to be signed.

127 * @param array $options Options for this method.

SecurityToken.php (https://github.com/sminnee/silverstripe-framework.git) PHP · 302 lines

1 <?php

2 /**

3 * @package framework

228 protected function generate() {

229 $generator = new RandomGenerator();

230 return $generator->randomToken('sha1');

231 }

232

cerfcube_defconfig (http://omnia2droid.googlecode.com/svn/trunk/) Unknown · 904 lines

869 # CONFIG_CRYPTO_MD4 is not set

870 CONFIG_CRYPTO_MD5=m

871 # CONFIG_CRYPTO_SHA1 is not set

872 # CONFIG_CRYPTO_SHA256 is not set

873 # CONFIG_CRYPTO_SHA512 is not set

oss.partial (http://opensource.apple.com/release/mac-os-x-1074/) Unknown · 41 lines

23 &lt;dict&gt;

24 &lt;key&gt;OpenSourceProject&lt;/key&gt;

25 &lt;string&gt;Digest-SHA1&lt;/string&gt;

26 &lt;key&gt;OpenSourceVersion&lt;/key&gt;

27 &lt;string&gt;2.12&lt;/string&gt;

29 &lt;string&gt;<a href="http://search.cpan.org/">http://search.cpan.org/</a>&lt;/string&gt;

30 &lt;key&gt;OpenSourceURL&lt;/key&gt;

31 &lt;string&gt;<a href="http://search.cpan.org/CPAN/authors/id/G/GA/GAAS/Digest-SHA1-2.12.tar.gz">http://search.cpan.org/CPAN/authors/id/G/GA/GAAS/Digest-SHA1-2.12.tar.gz</a>&lt;/string&gt;

32 &lt;key&gt;OpenSourceImportDate&lt;/key&gt;

33 &lt;string&gt;2010-03-15&lt;/string&gt;