PageRenderTime 496ms queryFilters 0ms Sphinxql 179ms GetByIds 312ms meta 0ms repositoryFilters 0ms languageFilters 0ms sourceFilters 0ms

35 results for 'php md5 repo:xp-framework/xp-framework' (496 ms)

Source

Language

Repository

UnixCrypt.class.php git://github.com/xp-framework/xp-framework.git | PHP | 246 lines
127
128        // PHP's crypt() function crashes if the salt is too short due to PHP 
129        // using its own DES implementations as 5.3 - these don't check the 
153      if (!CRYPT_MD5) {
154        self::$MD5= XPClass::forName('security.crypto.MD5CryptImpl')->newInstance();
155      } else {
160        // breaks when the salt is too short. 5.3.7 is the first version to get it
161        // right, except: In PHP Bug #55439, crypt() returns just the salt for MD5
162        // on Un*x systems. This bug first occurred in PHP 5.3.7 RC6 and was shipped 
164        if ($builtin && version_compare(PHP_VERSION, '5.3.7', 'lt')) {
165          self::$MD5= XPClass::forName('security.crypto.MD5CryptImpl')->newInstance();
166        } else if (0 === strpos(PHP_VERSION, '5.3.7')) {
167          if ('$1$' === crypt('', '$1$')) {
168            self::$MD5= XPClass::forName('security.crypto.MD5CryptImpl')->newInstance();
169          }
MD5CryptImpl.class.php git://github.com/xp-framework/xp-framework.git | PHP | 109 lines
1<?php
2/* This class is part of the XP framework
9  /**
10   * MD5 Crypt implementation
11   *
20   *
21   * @see   php://md5
22   * @see   php://pack
23   * @see   xp://security.crypto.UnixCrypt
24   * @see   https://bugs.php.net/bug.php?id=55439
25   */
25   */
26  class MD5CryptImpl extends security�crypto�CryptImpl {
27    const MAGIC = '$1$';
65      $ctx= $plain.self::MAGIC.$salt;
66      $final= pack('H*', md5($plain.$salt.$plain));
67      $l= strlen($plain);
MD5HexHashImplementation.class.php git://github.com/xp-framework/xp-framework.git | PHP | 38 lines
1<?php
2/* This class is part of the XP framework
9  /**
10   * MD5 implementation that uses hexdec() on md5() to calculate the
11   * numeric value instead of relying on addition taking care of this.
14   * <pre>
15   *   $ php -r '$o= 0; $o+= "0x12195d4e54299a3cc1bde564c5de04b6"; var_dump($o);'
16   *
20   *
21   * @see   php://md5
22   * @see   php://hexdec
23   * @see   xp://util.collections.HashProvider
24   * @test  xp://net.xp_framework.unittest.util.collections.MD5HexHashImplementationTest:
25   */
25   */
26  class MD5HexHashImplementation extends Object implements HashImplementation {
27
MD5.class.php git://github.com/xp-framework/xp-framework.git | PHP | 47 lines
9  /**
10   * MD5 checksum
11   *
12   * @see      xp://security.checksum.Checksum
13   * @see      php://md5
14   * @purpose  Provide an API to check MD5 checksums
15   */
16  class MD5 extends Checksum {
17  
24    public static function fromString($str) {
25      return new MD5(md5($str));
26    }
43    public static function fromFile($file) {
44      return new MD5(md5_file($file->uri));
45    }
SieveClient.class.php git://github.com/xp-framework/xp-framework.git | PHP | 479 lines
1<?php
2/* This class is part of the XP framework
9    'peer.sieve.SieveScript',
10    'security.checksum.HMAC_MD5',
11    'security.sasl.DigestChallenge',
19  define('SIEVE_SASL_DIGEST_MD5',  'DIGEST-MD5');
20  define('SIEVE_SASL_CRAM_MD5',    'CRAM-MD5');
21
98      // "IMPLEMENTATION" "Cyrus timsieved v1.0.0"
99      // "SASL" "LOGIN PLAIN KERBEROS_V4 DIGEST-MD5 CRAM-MD5"
100      // "SIEVE" "fileinto reject envelope vacation imapflags notify subaddress regex"
241     *   <li>LOGIN</li>
242     *   <li>DIGEST-MD5</li>
243     *   <li>CRAM-MD5</li>
278
279        case SIEVE_SASL_DIGEST_MD5:
280          $this->_sendcmd('AUTHENTICATE "DIGEST-MD5"');
HashProvider.class.php git://github.com/xp-framework/xp-framework.git | PHP | 95 lines
1<?php
2/* This class is part of the XP framework
6
7  uses('util.collections.MD5HashImplementation');
8
16   *
17   * Uses MD5 as default hashing implementation. To change the hashing
18   * implementation to be used, use the following:
23   * @see   xp://util.collections.DJBX33AHashImplementation
24   * @see   xp://util.collections.MD5HashImplementation
25   * @see   xp://util.collections.Map
37      
38      // Workaround for bugs in older PHP versions, see MD5HexHashImplementation's
39      // class apidoc for an explanation. Earlier versions returned LONG_MAX for
40      // hex numbers larger than LONG_MAX. Use 2^64 + 1 as hex literal and see if
41      // it's "truncated", using the slower hexdec(md5()) implementation then.
42      if (LONG_MAX === @0x20c49ba5e35423) {
SecureString.class.php git://github.com/xp-framework/xp-framework.git | PHP | 191 lines
1<?php
2/* This class is part of the XP Framework
19   * and it does share the encryption key with all instances of it in a single
20   * PHP instance.
21   *
66          $engineiv= mcrypt_create_iv(mcrypt_enc_get_iv_size($engine), MCRYPT_RAND);
67          $key= substr(md5(uniqid()), 0, mcrypt_enc_get_key_size($engine));
68          mcrypt_generic_init($engine, $key, $engineiv);
79          }
80          $key= md5(uniqid());
81          $iv= substr(md5(uniqid()), 0, openssl_cipher_iv_length('des'));
File.class.php git://github.com/xp-framework/xp-framework.git | PHP | 726 lines
1<?php
2/* This class is part of the XP framework
45     *   // via resource
46     *   $f= new File(fopen('lang/Type.class.php', FILE_MODE_READ));
47     *
48     *   // via filename
49     *   $f= new File('lang/Type.class.php');
50     *  
51     *   // via dir- and filename
52     *   $f->new File('lang', 'Type.class.php');
53     *
54     *   // via folder and filename
55     *   $f->new File(new Folder('lang'), 'Type.class.php');
56     * </code>
143    public function setURI($uri) {
144      static $allowed= array('xar://*', 'php://stderr', 'php://stdout', 'php://stdin', 'res://*');
145
KeyPair.class.php git://github.com/xp-framework/xp-framework.git | PHP | 96 lines
1<?php
2/* This class is part of the XP framework
19   *   try {
20   *     if ($keypair= KeyPair::generate('md5', OPENSSL_KEYTYPE_RSA, 384)) {
21   *       $export= $keypair->export('krowemarf-px');
33   *
34   * @see      php://openssl_pkey_new
35   * @ext      openssl
44     * md2       MD2 Digest           
45     * md5       MD5 Digest           
46     * mdc2      MDC2 Digest          
51     *
52     * @param   string algorithm default "md5"
53     * @param   int type default OPENSSL_KEYTYPE_RSA
56     */
57    public static function generate($algorithm= 'md5', $type= OPENSSL_KEYTYPE_RSA, $bits= 1024) {
58      if (FALSE === ($res= openssl_pkey_new(array(
DigestAuthorization.class.php git://github.com/xp-framework/xp-framework.git | PHP | 247 lines
1<?php
2/* This class is part of the XP framework
73      $values= array(
74        'algorithm' => 'md5',
75        'opaque'    => NULL
81      if ($values['algorithm'] != 'md5') {
82        throw new MethodNotImplementedException('Digest auth only supported via algo "md5".', 'digest-md5');
83      }
103    public function hashFor($method, $requestUri) {
104      return md5(implode(':', array(
105        $this->ha1(),
176    private function ha1() {
177      return md5(implode(':', array($this->username, $this->realm, $this->password->getCharacters())));
178    }
187    private function ha2($method, $requestUri) {
188      return md5(implode(':', array(strtoupper($method), $requestUri)));
189    }
AbstractDigestTest.class.php git://github.com/xp-framework/xp-framework.git | PHP | 110 lines
1<?php namespace net\xp_framework\unittest\security\checksum;
2
7/**
8 * TestCase for MD5 digest
9 *
9 *
10 * @see      xp://security.checksum.MD5Digest
11 */
65  /**
66   * Test not calling update() results in the MD5 of an empty string
67   *
89  /**
90   * Test not calling update() results in the MD5 of an empty string
91   *
100  /**
101   * Test not calling update() results in the MD5 of an empty string
102   *
MessageDigest.class.php git://github.com/xp-framework/xp-framework.git | PHP | 77 lines
1<?php
2/* This class is part of the XP framework
18   * <code>
19   *   $digest= MessageDigest::newInstance('md5');
20   *   while ($in->available() > 0) {
22   *   }
23   *   $md5= new MD5($digest->final());
24   * </code>
28   * <code>
29   *   if ($md5->verify(new MD5('...'))) {
30   *     // Checksums match
HMAC_MD5.class.php git://github.com/xp-framework/xp-framework.git | PHP | 60 lines
1<?php
2/* This class is part of the XP framework
12   * @see      xp://security.checksum.Checksum
13   * @purpose  Provide an API to check HMAC_MD5 checksums
14   */
17    /**
18     * Calculate HMAC_MD5 for given string (and key, if specified)
19     *
34      
35      return HMAC_MD5::hash($op.pack('H*', md5($ip.$str)));
36    }
45    public static function fromString($str, $key= NULL) {
46      return new HMAC_MD5(HMAC_MD5::hash($str, $key));
47    }
56    public static function fromFile($file, $key= NULL) {
57      return new HMAC_MD5(HMAC_MD5::hash(FileUtil::getContents($file), $key));
58    }
MD5HashImplementation.class.php git://github.com/xp-framework/xp-framework.git | PHP | 28 lines
1<?php
2/* This class is part of the XP framework
9  /**
10   * MD5
11   *
11   *
12   * @see   php://md5
13   * @see   xp://util.collections.HashProvider
13   * @see   xp://util.collections.HashProvider
14   * @test  xp://net.xp_framework.unittest.util.collections.MD5HashImplementationTest:
15   */
15   */
16  class MD5HashImplementation extends Object implements HashImplementation {
17
24    public function hashOf($str) {
25      return '0x'.md5($str);
26    }
Bytes.class.php git://github.com/xp-framework/xp-framework.git | PHP | 185 lines
1<?php
2/* This class is part of the XP framework
57     *
58     * @see     php://language.oop5.iterations
59     * @return  php.Iterator
163    public function hashCode() {
164      return md5($this->buffer);
165    }
DefaultDigestImpl.class.php git://github.com/xp-framework/xp-framework.git | PHP | 75 lines
1<?php
2/* This class is part of the XP framework
12   * @ext      hash
13   * @test     xp://net.xp_framework.unittest.security.checksum.MD5DigestTest
14   * @test     xp://net.xp_framework.unittest.security.checksum.SHA1DigestTest
16   * @see      xp://security.checksum.MessageDigestImpl
17   * @see      xp://security.checksum.MD5
18   * @see      xp://security.checksum.SHA1
19   * @see      xp://security.checksum.CRC32
20   * @see      php://hash_algos
21   */
31      // Overwrite crc32b implementation if a buggy implementation is detected. 
32      // Workaround for http://bugs.php.net/bug.php?id=45028
33      if ('0a1cb779' === hash('crc32b', 'AAAAAAAA')) {
UUID.class.php git://github.com/xp-framework/xp-framework.git | PHP | 325 lines
1<?php
2/* This class is part of the XP framework
30   * <code>
31   *   UUID::md5UUID(UUID::$NS_DNS, 'example.com');
32   *   UUID::sha1UUID(UUID::$NS_DNS, 'example.com');
154      $clock_seq= mt_rand();
155      $h= md5(php_uname());
156
180     */
181    public static function md5UUID(self $namespace, $name) {
182      $bytes= md5($namespace->getBytes().iconv(xp::ENCODING, 'utf-8', $name));
MD5DigestTest.class.php git://github.com/xp-framework/xp-framework.git | PHP | 31 lines
1<?php namespace net\xp_framework\unittest\security\checksum;
2
2
3use security\checksum\MD5;
4
6/**
7 * TestCase for MD5 digest
8 *
8 *
9 * @see      xp://security.checksum.MD5Digest
10 */
10 */
11class MD5DigestTest extends AbstractDigestTest {
12
18  protected function newDigest() {
19    return MD5::digest();
20  }
URL.class.php git://github.com/xp-framework/xp-framework.git | PHP | 691 lines
1<?php
2/* This class is part of the XP framework
20   * @test   xp://net.xp_framework.unittest.peer.URLTest
21   * @see    php://parse_url
22   */
215     *
216     * @see     php://parse_str
217     * @param   string query
517    public function hashCode() {
518      return md5($this->getURL());
519    }
InternetAddress.class.php git://github.com/xp-framework/xp-framework.git | PHP | 144 lines
1<?php
2/* This class is part of the XP framework
59    public function hashCode() {
60      return md5($this->localpart.'@'.$this->domain);
61    }
1 2