$data = "Lorem ipsum dolor sit amet"; $shortHash = t3lib_div::shortMD5($data); echo $shortHash; // Outputs "7f43b5"
$filename = "example.pdf"; $fileHash = t3lib_div::shortMD5(file_get_contents($filename)); $newFilename = $fileHash . "-" . $filename; echo $newFilename; // Outputs "7f43b5-example.pdf"This example uses the shortMD5 function to create a unique identifier for a file. The hash is then used to create a new filename that includes the original file's extension. The t3lib_div library is a part of TYPO3 CMS and is used to provide various functions to developers working with the CMS.