Mixer.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /*
  3. * The RandomLib library for securely generating random numbers and strings in PHP
  4. *
  5. * @author Anthony Ferrara <ircmaxell@ircmaxell.com>
  6. * @copyright 2011 The Authors
  7. * @license http://www.opensource.org/licenses/mit-license.html MIT License
  8. * @version Build @@version@@
  9. */
  10. /**
  11. * The Mixer strategy interface.
  12. *
  13. * All mixing strategies must implement this interface
  14. *
  15. * PHP version 5.3
  16. *
  17. * @category PHPPasswordLib
  18. * @package Random
  19. *
  20. * @author Anthony Ferrara <ircmaxell@ircmaxell.com>
  21. * @author Paragon Initiative Enterprises <security@paragonie.com>
  22. * @copyright 2011 The Authors
  23. * @license http://www.opensource.org/licenses/mit-license.html MIT License
  24. *
  25. * @version Build @@version@@
  26. */
  27. namespace RandomLib;
  28. /**
  29. * The Mixer strategy interface.
  30. *
  31. * All mixing strategies must implement this interface
  32. *
  33. * @category PHPPasswordLib
  34. * @package Random
  35. *
  36. * @author Anthony Ferrara <ircmaxell@ircmaxell.com>
  37. * @author Paragon Initiative Enterprises <security@paragonie.com>
  38. * @codeCoverageIgnore
  39. */
  40. interface Mixer
  41. {
  42. /**
  43. * Return an instance of Strength indicating the strength of the mixer
  44. *
  45. * @return \SecurityLib\Strength An instance of one of the strength classes
  46. */
  47. public static function getStrength();
  48. /**
  49. * Test to see if the mixer is available
  50. *
  51. * @return bool If the mixer is available on the system
  52. */
  53. public static function test();
  54. /**
  55. * Even if the mixer is available,
  56. *
  57. * @return bool
  58. */
  59. public static function advisable();
  60. /**
  61. * Mix the provided array of strings into a single output of the same size
  62. *
  63. * All elements of the array should be the same size.
  64. *
  65. * @param array $parts The parts to be mixed
  66. *
  67. * @return string The mixed result
  68. */
  69. public function mix(array $parts);
  70. }