Code Duplication    Length = 12-13 lines in 2 locations

plugins/ispconfig-change-password/IspConfigChangePasswordDriver.php 1 location

@@ 139-150 (lines=12) @@
136
	 * @param string $sPassword
137
	 * @return string
138
	 */
139
	private function cryptPassword($sPassword)
140
	{
141
		$sSalt = '';
142
		$sBase64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
143
144
		for ($iIndex = 0; $iIndex < 8; $iIndex++)
145
		{
146
			$sSalt .= $sBase64[\rand(0, 63)];
147
		}
148
149
		return \crypt($sPassword, '$1$'.$sSalt.'$');
150
	}
151
}

plugins/mailcow-change-password/MailcowChangePasswordDriver.php 1 location

@@ 149-161 (lines=13) @@
146
	 * @param string $sPassword
147
	 * @return string
148
	 */
149
	private function cryptPassword($sPassword)
150
	{
151
		$sSalt = '';
152
		$sBase64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
153
154
		for ($iIndex = 0; $iIndex < 16; $iIndex++)
155
		{
156
			$sSalt .= $sBase64[\rand(0, 63)];
157
		}
158
159
		$crypted = \crypt($sPassword, '$6$'.$sSalt);
160
		return '{SHA512-CRYPT}'.$crypted;
161
	}
162
}
163