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));
    }