summaryrefslogtreecommitdiff
path: root/include/crypt.php
blob: 3e26dfd5a01a36fc49a029716c018d589372def0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
	function decrypt_string($str) {
		$pair = explode(":", $str);

		if (count($pair) == 2) {
			@$iv = base64_decode($pair[0]);
			@$encstr = base64_decode($pair[1]);

			if ($iv && $encstr) {
				$key = hash('SHA256', FEED_CRYPT_KEY, true);

				$str = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $encstr,
					MCRYPT_MODE_CBC, $iv);

				if ($str) return rtrim($str);
			}
		}

		return false;
	}