diff --git a/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/id_map/Sql.php b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/id_map/Sql.php
index 7f9cf0e..7df31b8 100644
--- a/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/id_map/Sql.php
+++ b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/id_map/Sql.php
@@ -258,7 +258,7 @@ protected function ensureTables() {
         );
         $fields['hash'] = array(
           'type' => 'varchar',
-          'length' => '32',
+          'length' => '64',
           'not null' => FALSE,
           'description' => 'Hash of source row data, for detecting changes',
         );
@@ -318,7 +318,7 @@ protected function ensureTables() {
         if (!$this->getDatabase()->schema()->fieldExists($this->mapTableName, 'hash')) {
           $this->getDatabase()->schema()->addField($this->mapTableName, 'hash', array(
             'type' => 'varchar',
-            'length' => '32',
+            'length' => '64',
             'not null' => FALSE,
             'description' => 'Hash of source row data, for detecting changes',
           ));
diff --git a/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlIdMapEnsureTablesTest.php b/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlIdMapEnsureTablesTest.php
index 28393fe..d63caa4 100644
--- a/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlIdMapEnsureTablesTest.php
+++ b/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlIdMapEnsureTablesTest.php
@@ -84,7 +84,7 @@ public function testEnsureTablesNotExist() {
     );
     $fields['hash'] = array(
       'type' => 'varchar',
-      'length' => '32',
+      'length' => '64',
       'not null' => FALSE,
       'description' => 'Hash of source row data, for detecting changes',
     );
@@ -172,7 +172,7 @@ public function testEnsureTablesExist() {
       ->will($this->returnValue(FALSE));
     $field_schema = array(
       'type' => 'varchar',
-      'length' => '32',
+      'length' => '64',
       'not null' => FALSE,
       'description' => 'Hash of source row data, for detecting changes',
     );
diff --git a/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlIdMapTest.php b/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlIdMapTest.php
index 9bce172..748ee80 100644
--- a/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlIdMapTest.php
+++ b/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlIdMapTest.php
@@ -738,4 +738,30 @@ public function testIterators() {
     $this->assertSame(iterator_to_array($id_map), $expected_results);
   }
 
+  /**
+   * Tests rehash functionality.
+   */
+  public function testRehash() {
+    $row_statuses = array(
+      MigrateIdMapInterface::STATUS_IMPORTED,
+      MigrateIdMapInterface::STATUS_NEEDS_UPDATE,
+      MigrateIdMapInterface::STATUS_IGNORED,
+      MigrateIdMapInterface::STATUS_FAILED,
+    );
+
+    // Create a mapping row for each STATUS constant.
+    foreach ($row_statuses as $status) {
+      $source = array('source_id_property' => 'source_value_' . $status);
+      $row = new Row($source, array('source_id_property' => array()));
+      $row->rehash();
+      // Check hash calculation algorithm.
+      $hash = hash('sha256', serialize($row->getSource()));
+      $id_map = $row->getIdMap();
+      $this->assertSame($hash, $id_map['hash']);
+      $this->assertSame('', $id_map['original_hash']);
+      // Check length of generated hash used for mapping schema.
+      $this->assertSame(64, strlen($id_map['hash']));
+    }
+  }
+
 }
