src/snapchat_agent.php
public function hash($first, $second) {
		// Append the secret to the values.
		$first = self::SECRET . $first;
		$second = $second . self::SECRET;

		// Hash the values.
		$hash = hash_init('sha256');
		hash_update($hash, $first);
		$hash1 = hash_final($hash);
		$hash = hash_init('sha256');
		hash_update($hash, $second);
		$hash2 = hash_final($hash);

		// Create a new hash with pieces of the two we just made.
		$result = '';
		for ($i = 0; $i < strlen(self::HASH_PATTERN); $i++) {
			$result .= substr(self::HASH_PATTERN, $i, 1) ? $hash2[$i] : $hash1[$i];
		}

		return $result;
	}
public function hash($first, $second) {
		// Append the secret to the values.
		$first = self::SECRET . $first;
		$second = $second . self::SECRET;

		// Hash the values.
		$hash = hash_init('sha256');
		hash_update($hash, $first);
		$hash1 = hash_final($hash);
		$hash = hash_init('sha256');
		hash_update($hash, $second);
		$hash2 = hash_final($hash);

		// Create a new hash with pieces of the two we just made.
		$result = '';
		for ($i = 0; $i < strlen(self::HASH_PATTERN); $i++) {
			$result .= substr(self::HASH_PATTERN, $i, 1) ? $hash2[$i] : $hash1[$i];
		}

		return $result;
	}
public function hash ( $ first , $ second ) { // Append the secret to the values. $ first = self :: SECRET . $ first ; $ second = $ second . self :: SECRET ; // Hash the values. $ hash = hash_init ( 'sha256' ) ; hash_update ( $ hash , $ first ) ; $ hash1 = hash_final ( $ hash ) ; $ hash = hash_init ( 'sha256' ) ; hash_update ( $ hash , $ second ) ; $ hash2 = hash_final ( $ hash ) ; // Create a new hash with pieces of the two we just made. $ result = '' ; for ( $ i = 0 ; $ i < strlen ( self :: HASH_PATTERN ) ; $ i ++ ) { $ result .= substr ( self :: HASH_PATTERN , $ i , 1 ) ? $ hash2 [ $ i ] : $ hash1 [ $ i ] ; } return $ result ; }
Implementation of Snapchat's hashing algorithm.

@param string $first
The first value to use in the hash.
@param string $second
The second value to use in the hash.

@return string
The generated hash.
Implementation of Snapchat s hashing algorithm .