Skip to content

Commit ed23ba2

Browse files
Consistently use 7 chars of sha256 for hash-based id generation
1 parent efc3379 commit ed23ba2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Field/FileFormField.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function setValue($value)
5959
$name = $info['basename'];
6060

6161
// copy to a tmp location
62-
$tmp = sys_get_temp_dir().'/'.sha1(uniqid(mt_rand(), true));
62+
$tmp = sys_get_temp_dir().'/'.strtr(substr(base64_encode(hash('sha256', uniqid(mt_rand(), true), true)), 0, 7), '/', '_');
6363
if (array_key_exists('extension', $info)) {
6464
$tmp .= '.'.$info['extension'];
6565
}

0 commit comments

Comments
 (0)