Merge pull request #373 from BelleNottelling/hashes

Replace SHA1 and MD5 with SHA256
This commit is contained in:
Yağızhan authored and GitHub committed 2022-11-17 07:41:11 +03:00
commit 0812c69d52
6 files changed
+9 -9

No files matched your search

@@ -46,7 +46,7 @@ class Model_ClientPasswordResetTable implements \Box\InjectionAwareInterface
}
$r->ip = $ip;
$r->hash = sha1(random_int(50, random_int(10, 99)));
$r->hash = hash('sha256', random_int(50, random_int(10, 99)));
$r->updated_at = date('Y-m-d H:i:s');
$this->di['db']->store($r);
+1 -1
View File
@@ -184,7 +184,7 @@ class Guest extends \Api_Abstract
throw new \Box_Exception('Email not found in our database');
}
$hash = sha1(time() . uniqid());
$hash = hash('sha256', time().random_bytes(13));
$reset = $this->di['db']->dispense('ClientPasswordReset');
$reset->client_id = $c->id;
+2 -2
View File
@@ -548,7 +548,7 @@ class Service implements InjectionAwareInterface
$model->serie = $systemService->getParamValue('invoice_series');
$model->nr = $model->id;
$model->hash = sha1(uniqid());
$model->hash = hash('sha256', random_bytes(13));
$taxtitle = '';
$taxService = $this->di['mod_service']('Invoice', 'Tax');
@@ -665,7 +665,7 @@ class Service implements InjectionAwareInterface
$new = $this->di['db']->dispense('Invoice');
$new->client_id = $invoice->client_id;
$new->hash = md5(random_bytes(13));
$new->hash = hash('sha256', random_bytes(13));
$new->status = \Model_Invoice::STATUS_REFUNDED;
$new->currency = $invoice->currency;
$new->approved = true;
+2 -2
View File
@@ -128,7 +128,7 @@ class Admin extends \Api_Abstract
$msg->queue_id = $q->id;
$msg->handler = $handler;
$msg->body = $body;
$msg->hash = md5($body);
$msg->hash = hash('sha256', $body);
$msg->created_at = date('Y-m-d H:i:s');
$msg->updated_at = date('Y-m-d H:i:s');
@@ -294,7 +294,7 @@ class Admin extends \Api_Abstract
foreach ($stmt1->fetchAll() as $data) {
$stmt = $db->prepare($sql2);
$stmt->bindValue('handle', md5(random_bytes(23)), \PDO::PARAM_STR);
$stmt->bindValue('handle', hash('sha256', random_bytes(23)), \PDO::PARAM_STR);
$stmt->bindValue('id', $data['id'], \PDO::PARAM_INT);
$stmt->bindValue('timeout', $microtime);
if ($stmt->execute()) {
+2 -2
View File
@@ -842,7 +842,7 @@ class Service implements \Box\InjectionAwareInterface
}
$ticket = $this->di['db']->dispense('SupportPTicket');
$ticket->hash = sha1(random_bytes(13));
$ticket->hash = hash('sha256', random_bytes(13));
$ticket->author_name = $data['name'];
$ticket->author_email = $data['email'];
$ticket->subject = $subject;
@@ -1228,7 +1228,7 @@ class Service implements \Box\InjectionAwareInterface
$this->di['events_manager']->fire(['event' => 'onBeforeAdminPublicTicketOpen', 'params' => $data]);
$ticket = $this->di['db']->dispense('SupportPTicket');
$ticket->hash = sha1(random_bytes(13));
$ticket->hash = hash('sha256', random_bytes(13));
$ticket->author_name = $data['name'];
$ticket->author_email = $data['email'];
$ticket->subject = $data['subject'];
+1 -1
View File
@@ -1433,7 +1433,7 @@ class ServiceTest extends \BBTestCase
$result = $this->service->ticketCreateForGuest($data);
$this->assertIsString($result);
$this->assertEquals(strlen($result), 40);
$this->assertEquals(strlen($result), 64);
}
public function testTicketCreateForClient()