Commit | Line | Data |
---|---|---|
14d4f286 S |
1 | <?php |
2 | /** | |
3 | * The Random Number Source interface. | |
4 | * | |
5 | * All random number sources must implement this interface | |
6 | * | |
7 | * PHP version 5.3 | |
8 | * | |
9 | * @category PHPCryptLib | |
10 | * @package Random | |
11 | * @author Anthony Ferrara <ircmaxell@ircmaxell.com> | |
12 | * @copyright 2011 The Authors | |
13 | * @license http://www.opensource.org/licenses/mit-license.html MIT License | |
14 | * @version Build @@version@@ | |
15 | */ | |
16 | ||
17 | namespace CryptLib\Random; | |
18 | ||
19 | /** | |
20 | * The Random Number Source interface. | |
21 | * | |
22 | * All random number sources must implement this interface | |
23 | * | |
24 | * @category PHPCryptLib | |
25 | * @package Random | |
26 | * @author Anthony Ferrara <ircmaxell@ircmaxell.com> | |
27 | * @codeCoverageIgnore | |
28 | */ | |
29 | interface Source { | |
30 | ||
31 | /** | |
32 | * Return an instance of Strength indicating the strength of the source | |
33 | * | |
34 | * @return Strength An instance of one of the strength classes | |
35 | */ | |
36 | public static function getStrength(); | |
37 | ||
38 | /** | |
39 | * Generate a random string of the specified size | |
40 | * | |
41 | * Note: If the source fails to generate enough data, the result must be | |
42 | * padded to the requested length. | |
43 | * | |
44 | * @param int $size The size of the requested random string | |
45 | * | |
46 | * @return string A string of the requested size | |
47 | */ | |
48 | public function generate($size); | |
49 | ||
50 | } |