@@ -259,12 +286,13 @@ function filehash_merge($file) {
* Adds any database columns required by configuration.
*/
functionfilehash_add_columns(){
$lengths=filehash_lengths();
foreach(filehash_algos()as$column=>$algo){
if(!db_field_exists('filehash',$column)){
db_add_field('filehash',$column,array(
'description'=>"The $algo hash for this file.",
'type'=>'char',
'length'=>strlen(hash($algo,'')),
'length'=>$lengths[$column],
'not null'=>FALSE,
));
}
@@ -388,3 +416,46 @@ function filehash_theme() {
),
);
}
/**
* Implements hook_help().
*/
functionfilehash_help($path){
switch($path){
case'admin/help#filehash':
case'admin/config/media/filehash':
returnfunction_exists('sodium_crypto_generichash_init')?t('Note, the BLAKE2b hash algorithm requires the Sodium PHP extension, which is currently enabled.'):t('Note, the BLAKE2b hash algorithm requires the Sodium PHP extension, which is not currently enabled.');
}
}
/**
* Implements hash_file() for the BLAKE2b hash algorithm.