Skip to content

Commit ebe961b

Browse files
committed
Switch to generating UUID4 components with wp_rand(), which is usually cryptographically secure.
1 parent 425bc36 commit ebe961b

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/wp-includes/functions.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7958,14 +7958,14 @@ function wp_raise_memory_limit( $context = 'admin' ) {
79587958
function wp_generate_uuid4() {
79597959
return sprintf(
79607960
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
7961-
mt_rand( 0, 0xffff ),
7962-
mt_rand( 0, 0xffff ),
7963-
mt_rand( 0, 0xffff ),
7964-
mt_rand( 0, 0x0fff ) | 0x4000,
7965-
mt_rand( 0, 0x3fff ) | 0x8000,
7966-
mt_rand( 0, 0xffff ),
7967-
mt_rand( 0, 0xffff ),
7968-
mt_rand( 0, 0xffff )
7961+
wp_rand( 0, 0xffff ),
7962+
wp_rand( 0, 0xffff ),
7963+
wp_rand( 0, 0xffff ),
7964+
wp_rand( 0, 0x0fff ) | 0x4000,
7965+
wp_rand( 0, 0x3fff ) | 0x8000,
7966+
wp_rand( 0, 0xffff ),
7967+
wp_rand( 0, 0xffff ),
7968+
wp_rand( 0, 0xffff )
79697969
);
79707970
}
79717971

0 commit comments

Comments
 (0)