Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function DatabaseSchema_pgsql::hashBase64

Calculates a base-64 encoded, PostgreSQL-safe sha-256 hash per PostgreSQL documentation: 4.1. Lexical Structure.

Parameters

$data: String to be hashed.

Return value

string A base-64 encoded sha-256 hash, with + and / replaced with _ and any = padding characters removed.

1 call to DatabaseSchema_pgsql::hashBase64()
DatabaseSchema_pgsql::ensureIdentifiersLength in includes/database/pgsql/schema.inc
Make sure to limit identifiers according to PostgreSQL compiled in length.

File

includes/database/pgsql/schema.inc, line 836

Class

DatabaseSchema_pgsql

Code

protected function hashBase64($data) {
 // Ensure lowercase as D7's pgsql driver does not quote identifiers
 // consistently, and they are therefore folded to lowercase by PostgreSQL.
 $hash = strtolower (base64_encode (hash ('sha256', $data, TRUE)));
 // Modify the hash so it's safe to use in PostgreSQL identifiers.
 return strtr ($hash, array(
 '+' => '_',
 '/' => '_',
 '=' => '',
 ));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.