public static function datafileHashcode ($filename, $id, $mimetype, $content) {
        $attributes = array (
            'xmlns'       => 'http://www.sk.ee/DigiDoc/v1.3.0#',
            'ContentType' => 'EMBEDDED_BASE64',
            'Filename'    => $filename,
            'Id'          => $id,
            'MimeType'    => $mimetype,
            'Size'        => strlen($content)
        );

        $xml = '<DataFile';
        foreach ($attributes as $key => $val) {
            $xml .= " $key=\"" . htmlspecialchars($val) . "\"";
        }

        $xml .= '>' . self::consistantBase64Encoder($content, true);
        $xml .= '</DataFile>';

        return base64_encode(sha1($xml, true));
    }
public static function datafileHashcode ($filename, $id, $mimetype, $content) {
        $attributes = array (
            'xmlns'       => 'http://www.sk.ee/DigiDoc/v1.3.0#',
            'ContentType' => 'EMBEDDED_BASE64',
            'Filename'    => $filename,
            'Id'          => $id,
            'MimeType'    => $mimetype,
            'Size'        => strlen($content)
        );

        $xml = '<DataFile';
        foreach ($attributes as $key => $val) {
            $xml .= " $key=\"" . htmlspecialchars($val) . "\"";
        }

        $xml .= '>' . self::consistantBase64Encoder($content, true);
        $xml .= '</DataFile>';

        return base64_encode(sha1($xml, true));
    }
public static function datafileHashcode ( $ filename , $ id , $ mimetype , $ content ) { $ attributes = array ( 'xmlns' => 'http://www.sk.ee/DigiDoc/v1.3.0#' , 'ContentType' => 'EMBEDDED_BASE64' , 'Filename' => $ filename , 'Id' => $ id , 'MimeType' => $ mimetype , 'Size' => strlen ( $ content ) ) ; $ xml = '<DataFile' ; foreach ( $ attributes as $ key => $ val ) { $ xml .= " $key=\"" . htmlspecialchars ( $ val ) . "\"" ; } $ xml .= '>' . self :: consistantBase64Encoder ( $ content , true ) ; $ xml .= '</DataFile>' ; return base64_encode ( sha1 ( $ xml , true ) ) ; }
Utility method to calculate file hashcode for using with DDS AddDataFile mehtod.

@param string $filename filename
@param string $id       file id. D0 for first file D1 for second and so on...
@param string $mimetype file mime type
@param string $content  file content

@return string file base64 encode file hashcode
Utility method to calculate file hashcode for using with DDS AddDataFile mehtod .