hash.

@param int    $uin
@param string $ptWebQQ

@return string
970829
public static function hash($uin, $ptWebQQ)
    {
        $x = array(
            0, $uin >> 24 & 0xff ^ 0x45,
            0, $uin >> 16 & 0xff ^ 0x43,
            0, $uin >> 8 & 0xff ^ 0x4f,
            0, $uin & 0xff ^ 0x4b,
        );
        for ($i = 0; $i < 64; ++$i) {
            $x[($i & 3) << 1] ^= ord(substr($ptWebQQ, $i, 1));
        }
        $hex = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
        $hash = '';
        for ($i = 0; $i < 8; ++$i) {
            $hash .= $hex[$x[$i] >> 4 & 0xf].$hex[$x[$i] & 0xf];
        }

        return $hash;
    }
329760
def to_hash(args = {}) # :nodoc:
      args ||= {}

      if args[:nested]
        {'url' => self[:@url] || self[:url]}
      else
        hash = super
        hash.merge!('@version' => self['@version']) unless new_record?
        {self.class.json_name => hash}
      end
    end
1193185
public static function hash($value) : string
    {
        if (is_object($value)) {
            if ($value instanceof IHashable) {
                return get_class($value) . ':' . $value->getObjectHash();
            } else {
                return serialize($value);
            }
        }

        return Identity::hash($value);
    }
314424
public function hashCode()
    {
        $validPk = null !== $this->getMediaId() &&
            null !== $this->getPageId();

        $validPrimaryKeyFKs = 2;
        $primaryKeyFKs = [];

        //relation m2p_fk_32dfd1 to table media
        if ($this->aMedia && $hash = spl_object_hash($this->aMedia)) {
            $primaryKeyFKs[] = $hash;
        } else {
            $validPrimaryKeyFKs = false;
        }

        //relation m2p_fk_c9a38a to table page
        if ($this->aPage && $hash = spl_object_hash($this->aPage)) {
            $primaryKeyFKs[] = $hash;
        } else {
            $validPrimaryKeyFKs = false;
        }

        if ($validPk) {
            return crc32(json_encode($this->getPrimaryKey(), JSON_UNESCAPED_UNICODE));
        } elseif ($validPrimaryKeyFKs) {
            return crc32(json_encode($primaryKeyFKs, JSON_UNESCAPED_UNICODE));
        }

        return spl_object_hash($this);
    }
1218859
public static WxaEntrustwebData generatePapayWxaEntrustweb(PapayEntrustweb papayEntrustweb, String key) {
		Map<String, String> map = MapUtil.objectToMap(papayEntrustweb);
		String sign = SignatureUtil.generateSign(map, "HMAC-SHA256", key);
		papayEntrustweb.setSign(sign);
		WxaEntrustwebData wxaEntrustwebData = new WxaEntrustwebData();
		wxaEntrustwebData.setAppId(papayEntrustweb.getAppid());
		wxaEntrustwebData.setExtraData(papayEntrustweb);
		wxaEntrustwebData.setPath("pages/index/index");
		return wxaEntrustwebData;
	}
368394
static int hash(int hashIn, int n) {
		int hash = ((hashIn << 5) + hashIn) + (n & 0xFF); /* hash * 33 + c */
		hash = ((hash << 5) + hash) + ((n >> 8) & 0xFF);
		hash = ((hash << 5) + hash) + ((n >> 16) & 0xFF);
		hash = ((hash << 5) + hash) + ((n >> 24) & 0xFF);
		hash &= 0x7FFFFFFF;
		return hash;
	}
1211642
int hash(ByteBuffer indices, ByteBuffer vertices, ByteBuffer normals, ByteBuffer colors) {
		int hashCode = 0;
		hashCode += indices.hashCode();
		hashCode += vertices.hashCode();
		hashCode += normals.hashCode();
		hashCode += colors.hashCode();
		
		return hashCode;
	}
1039980
def fuid(path = nil)
      if @uid.nil? && path.nil?
        1
      else
        @uid || Digest::MD5.hexdigest(path).to_i(16) % 10000
      end
    end
366535
public static int pjwHash(String str) {
		int bitsInUnsignedInt = 32;
		int threeQuarters = (bitsInUnsignedInt * 3) / 4;
		int oneEighth = bitsInUnsignedInt / 8;
		int highBits = 0xFFFFFFFF << (bitsInUnsignedInt - oneEighth);
		int hash = 0;
		int test = 0;

		for (int i = 0; i < str.length(); i++) {
			hash = (hash << oneEighth) + str.charAt(i);

			if ((test = hash & highBits) != 0) {
				hash = ((hash ^ (test >> threeQuarters)) & (~highBits));
			}
		}

		return hash & 0x7FFFFFFF;
	}
577509
protected function getQrCodeStatus($ptQrToken)
    {
        $request = new Request\VerifyQrCodeRequest($ptQrToken);
        $response = $this->sendRequest($request);
        if (false !== strpos($response->getBody(), '未失效')) {
            $status = Request\VerifyQrCodeRequest::STATUS_UNEXPIRED;
        } elseif (false !== strpos($response->getBody(), '已失效')) {
            $status = Request\VerifyQrCodeRequest::STATUS_EXPIRED;
        } elseif (false !== strpos($response->getBody(), '认证中')) {
            $status = Request\VerifyQrCodeRequest::STATUS_ACCREDITATION;
        } else {
            $status = Request\VerifyQrCodeRequest::STATUS_CERTIFICATION;
            //找出认证url
            if (preg_match("#'(http.+)'#U", strval($response->getBody()), $matches)) {
                $this->certificationUrl = trim($matches[1]);
            } else {
                throw new RuntimeException('Can not find certification url');
            }
        }

        return $status;
    }
991591
public function hash($string, $algo)
    {
        if (true === empty($string)) {
            $string = microtime() . uniqid();
        }

        return hash($algo, $string);
    }
867406
public function buildRecordQuery($type, $uid, $pageId): Query
    {
        $siteRepository = GeneralUtility::makeInstance(SiteRepository::class);
        $site = $siteRepository->getSiteByPageId($pageId);

        return $this->newSearchQuery('')
            ->useQueryString('*:*')
            ->useFilter('type:' . $type . ' AND uid:' . $uid, 'type')
            ->useFilter('siteHash:' . $site->getSiteHash(), 'siteHash')
            ->useReturnFields(ReturnFields::fromString('*'))
            ->useSortings(Sortings::fromString('type asc, title asc'))
            ->useQueryType('standard')
            ->getQuery();
    }
874857
private function convertHashToArrayOfBoolean()
    {
        preg_match_all('/(\d)[\w]/', $this->hash, $matches);
        $this->color = array_map(function ($data) {
            return hexdec($data) * 16;
        }, array_reverse($matches[1]));

        return $this;
    }
273129
function hashUUID(hashFn, options, buffer, offset) {
	var i, v;
	var output = buffer || new Buffer(16);
	offset = offset || 0;
	options = options || {};

	if (!options.data) {
		for (i=0; i<16; i++) {
			output[i] = 0;
		}
		return buffer || unparse(output);
	}

	if (typeof options.ns === 'string') {
		options.ns = parse(options.ns, new Buffer(16));
	}

	var hasher = crypto.createHash(hashFn);
	hasher.update(options.ns || '');
	hasher.update(options.data || '');

	switch (hashFn) {
		case 'md5': v = 0x30; break;
		case 'sha1': v = 0x50; break;
	}
	output.write(hasher.digest('binary'), offset, 16, 'binary');
	output[offset + 8] = output[offset + 8] & 0x3f | 0x80; // set variant
	output[offset + 6] = output[offset + 6] & 0x0f | v; // set version

	return buffer || unparse(output);
}
599892
def to_hash
      action = @parameters[:action]
      userid = @parameters[:userid]
      appname = @parameters[:appname] || @appname
      patientid = @parameters[:patientid]
      token = @parameters[:token] || @security_token
      parameter1 = process_date(@parameters[:parameter1]) || ''
      parameter2 = process_date(@parameters[:parameter2]) || ''
      parameter3 = process_date(@parameters[:parameter3]) || ''
      parameter4 = process_date(@parameters[:parameter4]) || ''
      parameter5 = process_date(@parameters[:parameter5]) || ''
      parameter6 = process_date(@parameters[:parameter6]) || ''
      data = Utilities::encode_data(@parameters[:data]) || ''

      {
        'Action' => action,
        'AppUserID' => userid,
        'Appname' => appname,
        'PatientID' => patientid,
        'Token' => token,
        'Parameter1' => parameter1,
        'Parameter2' => parameter2,
        'Parameter3' => parameter3,
        'Parameter4' => parameter4,
        'Parameter5' => parameter5,
        'Parameter6' => parameter6,
        'Data' => data
      }
    end
326172
function _hashInlineCryptFunction($bytes)
    {
        if (!defined('CRYPT_BASE_WHIRLPOOL_AVAILABLE')) {
            define('CRYPT_BASE_WHIRLPOOL_AVAILABLE', (bool)(extension_loaded('hash') && in_array('whirlpool', hash_algos())));
        }

        $result = '';
        $hash = $bytes;

        switch (true) {
            case CRYPT_BASE_WHIRLPOOL_AVAILABLE:
                foreach (str_split($bytes, 64) as $t) {
                    $hash = hash('whirlpool', $hash, true);
                    $result .= $t ^ $hash;
                }
                return $result . hash('whirlpool', $hash, true);
            default:
                $len = strlen($bytes);
                for ($i = 0; $i < $len; $i+=20) {
                    $t = substr($bytes, $i, 20);
                    $hash = pack('H*', sha1($hash));
                    $result .= $t ^ $hash;
                }
                return $result . pack('H*', sha1($hash));
        }
    }
213813
public static function pbkdf2($algo, $password, $salt, $iterations, $length = 0)
    {
        if (!\in_array($algo, \hash_algos(), true)) {
            throw new \Exception('PBKDF2 ERROR: Invalid hash algorithm.');
        }

        $hashlen = self::ourStrlen(\hash($algo, "", true));
        if ($hashlen === 0) {
            return '';
        }

        $block_count = \ceil($length / $hashlen);

        $output = '';
        for ($i = 1; $i <= $block_count; ++$i) {
            $last = $salt.\pack('N', $i);
            $xorsum = \hash_hmac($algo, $last, $password, true);
            $last = $xorsum;
            for ($j = 1; $j < $iterations; ++$j) {
                $xorsum ^= ($last = \hash_hmac($algo, $last, $password, true));
            }
            $output .= $xorsum;
        }
        return self::ourSubstr($output, 0, $length);
    }