Completed
Pull Request — master (#7849)
by Morris
68:43 queued 54:37
created
lib/public/Security/ISecureRandom.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -40,56 +40,56 @@
 block discarded – undo
40 40
  */
41 41
 interface ISecureRandom {
42 42
 
43
-	/**
44
-	 * Flags for characters that can be used for <code>generate($length, $characters)</code>
45
-	 */
46
-	const CHAR_UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
47
-	const CHAR_LOWER = 'abcdefghijklmnopqrstuvwxyz';
48
-	const CHAR_DIGITS = '0123456789';
49
-	const CHAR_SYMBOLS = '!\"#$%&\\\'()* +,-./:;<=>?@[\]^_`{|}~';
43
+    /**
44
+     * Flags for characters that can be used for <code>generate($length, $characters)</code>
45
+     */
46
+    const CHAR_UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
47
+    const CHAR_LOWER = 'abcdefghijklmnopqrstuvwxyz';
48
+    const CHAR_DIGITS = '0123456789';
49
+    const CHAR_SYMBOLS = '!\"#$%&\\\'()* +,-./:;<=>?@[\]^_`{|}~';
50 50
 
51
-	/**
52
-	 * Characters that can be used for <code>generate($length, $characters)</code>, to
53
-	 * generate human readable random strings. Lower- and upper-case characters and digits 
54
-	 * are included. Characters which are ambiguous are excluded, such as I, l, and 1 and so on.
55
-	 */
56
-	const CHAR_HUMAN_READABLE = 'abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789';
51
+    /**
52
+     * Characters that can be used for <code>generate($length, $characters)</code>, to
53
+     * generate human readable random strings. Lower- and upper-case characters and digits 
54
+     * are included. Characters which are ambiguous are excluded, such as I, l, and 1 and so on.
55
+     */
56
+    const CHAR_HUMAN_READABLE = 'abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789';
57 57
 
58
-	/**
59
-	 * Convenience method to get a low strength random number generator.
60
-	 *
61
-	 * Low Strength should be used anywhere that random strings are needed
62
-	 * in a non-cryptographical setting. They are not strong enough to be
63
-	 * used as keys or salts. They are however useful for one-time use tokens.
64
-	 *
65
-	 * @return $this
66
-	 * @since 8.0.0
67
-	 * @deprecated 9.0.0 Use \OC\Security\SecureRandom::generate directly or random_bytes() / random_int()
68
-	 */
69
-	public function getLowStrengthGenerator();
58
+    /**
59
+     * Convenience method to get a low strength random number generator.
60
+     *
61
+     * Low Strength should be used anywhere that random strings are needed
62
+     * in a non-cryptographical setting. They are not strong enough to be
63
+     * used as keys or salts. They are however useful for one-time use tokens.
64
+     *
65
+     * @return $this
66
+     * @since 8.0.0
67
+     * @deprecated 9.0.0 Use \OC\Security\SecureRandom::generate directly or random_bytes() / random_int()
68
+     */
69
+    public function getLowStrengthGenerator();
70 70
 
71
-	/**
72
-	 * Convenience method to get a medium strength random number generator.
73
-	 *
74
-	 * Medium Strength should be used for most needs of a cryptographic nature.
75
-	 * They are strong enough to be used as keys and salts. However, they do
76
-	 * take some time and resources to generate, so they should not be over-used
77
-	 *
78
-	 * @return $this
79
-	 * @since 8.0.0
80
-	 * @deprecated 9.0.0 Use \OC\Security\SecureRandom::generate directly or random_bytes() / random_int()
81
-	 */
82
-	public function getMediumStrengthGenerator();
71
+    /**
72
+     * Convenience method to get a medium strength random number generator.
73
+     *
74
+     * Medium Strength should be used for most needs of a cryptographic nature.
75
+     * They are strong enough to be used as keys and salts. However, they do
76
+     * take some time and resources to generate, so they should not be over-used
77
+     *
78
+     * @return $this
79
+     * @since 8.0.0
80
+     * @deprecated 9.0.0 Use \OC\Security\SecureRandom::generate directly or random_bytes() / random_int()
81
+     */
82
+    public function getMediumStrengthGenerator();
83 83
 
84
-	/**
85
-	 * Generate a random string of specified length.
86
-	 * @param int $length The length of the generated string
87
-	 * @param string $characters An optional list of characters to use if no character list is
88
-	 * 							specified all valid base64 characters are used.
89
-	 * @return string
90
-	 * @since 8.0.0
91
-	 */
92
-	public function generate(int $length,
93
-							 string $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'): string;
84
+    /**
85
+     * Generate a random string of specified length.
86
+     * @param int $length The length of the generated string
87
+     * @param string $characters An optional list of characters to use if no character list is
88
+     * 							specified all valid base64 characters are used.
89
+     * @return string
90
+     * @since 8.0.0
91
+     */
92
+    public function generate(int $length,
93
+                                string $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'): string;
94 94
 
95 95
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 /**
4 4
  * @copyright Copyright (c) 2016, ownCloud, Inc.
5 5
  *
Please login to merge, or discard this patch.
lib/private/Security/SecureRandom.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -37,51 +37,51 @@
 block discarded – undo
37 37
  * @package OC\Security
38 38
  */
39 39
 class SecureRandom implements ISecureRandom {
40
-	/**
41
-	 * Convenience method to get a low strength random number generator.
42
-	 *
43
-	 * Low Strength should be used anywhere that random strings are needed
44
-	 * in a non-cryptographical setting. They are not strong enough to be
45
-	 * used as keys or salts. They are however useful for one-time use tokens.
46
-	 *
47
-	 * @deprecated 9.0.0 Use \OC\Security\SecureRandom::generate directly or random_bytes() / random_int()
48
-	 * @return $this
49
-	 */
50
-	public function getLowStrengthGenerator() {
51
-		return $this;
52
-	}
40
+    /**
41
+     * Convenience method to get a low strength random number generator.
42
+     *
43
+     * Low Strength should be used anywhere that random strings are needed
44
+     * in a non-cryptographical setting. They are not strong enough to be
45
+     * used as keys or salts. They are however useful for one-time use tokens.
46
+     *
47
+     * @deprecated 9.0.0 Use \OC\Security\SecureRandom::generate directly or random_bytes() / random_int()
48
+     * @return $this
49
+     */
50
+    public function getLowStrengthGenerator() {
51
+        return $this;
52
+    }
53 53
 
54
-	/**
55
-	 * Convenience method to get a medium strength random number generator.
56
-	 *
57
-	 * Medium Strength should be used for most needs of a cryptographic nature.
58
-	 * They are strong enough to be used as keys and salts. However, they do
59
-	 * take some time and resources to generate, so they should not be over-used
60
-	 *
61
-	 * @deprecated 9.0.0 Use \OC\Security\SecureRandom::generate directly or random_bytes() / random_int()
62
-	 * @return $this
63
-	 */
64
-	public function getMediumStrengthGenerator() {
65
-		return $this;
66
-	}
54
+    /**
55
+     * Convenience method to get a medium strength random number generator.
56
+     *
57
+     * Medium Strength should be used for most needs of a cryptographic nature.
58
+     * They are strong enough to be used as keys and salts. However, they do
59
+     * take some time and resources to generate, so they should not be over-used
60
+     *
61
+     * @deprecated 9.0.0 Use \OC\Security\SecureRandom::generate directly or random_bytes() / random_int()
62
+     * @return $this
63
+     */
64
+    public function getMediumStrengthGenerator() {
65
+        return $this;
66
+    }
67 67
 
68
-	/**
69
-	 * Generate a random string of specified length.
70
-	 * @param int $length The length of the generated string
71
-	 * @param string $characters An optional list of characters to use if no character list is
72
-	 * 							specified all valid base64 characters are used.
73
-	 * @return string
74
-	 */
75
-	public function generate(int $length,
76
-							 string $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'): string {
77
-		$maxCharIndex = \strlen($characters) - 1;
78
-		$randomString = '';
68
+    /**
69
+     * Generate a random string of specified length.
70
+     * @param int $length The length of the generated string
71
+     * @param string $characters An optional list of characters to use if no character list is
72
+     * 							specified all valid base64 characters are used.
73
+     * @return string
74
+     */
75
+    public function generate(int $length,
76
+                                string $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'): string {
77
+        $maxCharIndex = \strlen($characters) - 1;
78
+        $randomString = '';
79 79
 
80
-		while($length > 0) {
81
-			$randomNumber = \random_int(0, $maxCharIndex);
82
-			$randomString .= $characters[$randomNumber];
83
-			$length--;
84
-		}
85
-		return $randomString;
86
-	}
80
+        while($length > 0) {
81
+            $randomNumber = \random_int(0, $maxCharIndex);
82
+            $randomString .= $characters[$randomNumber];
83
+            $length--;
84
+        }
85
+        return $randomString;
86
+    }
87 87
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 /**
4 4
  * @copyright Copyright (c) 2016, ownCloud, Inc.
5 5
  *
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		$maxCharIndex = \strlen($characters) - 1;
77 77
 		$randomString = '';
78 78
 
79
-		while($length > 0) {
79
+		while ($length > 0) {
80 80
 			$randomNumber = \random_int(0, $maxCharIndex);
81 81
 			$randomString .= $characters[$randomNumber];
82 82
 			$length--;
Please login to merge, or discard this patch.