Re: p:hash : add reference and replace sha1 by sha with a version parameter

Here is a proposed revised version of the spec

7.2.2 p:hash

The p:hash step generates a hash, or digital "fingerprint", for some value
and injects it into the source document.

<p:declare-step type="p:hash">
     <p:input port="source" primary="true"/>
     <p:output port="result"/>
     <p:input port="parameters" kind="parameter"/>
     <p:option name="value" required="true"/>                      <!--
string -->
     <p:option name="algorithm" required="true"/>                  <!--
QName -->
     <p:option name="match" required="true"/>                      <!--
XSLTMatchPattern -->

     <p:option name="version" required="true"/>                      <!--
string -->
</p:declare-step>

The value of the algorithm option must be a QName. If it does not have a
prefix, then it must be one of the following values: "crc", "md", "sha",
"whirlpool" and "ripemd".

The value of the version option must be a string.

A hash is constructed from the string specified in the value option using
the specified algorithm.

The value of the match option must be an XSLTMatchPattern.

The hash of the specified value is computed using the algorithm and
parameters specified. It is a *dynamic
error<http://www.w3.org/XML/XProc/docs/langspec.html#dt-dynamic-error>
* (err:XC0036 <http://www.w3.org/XML/XProc/docs/langspec.html#err.C0036>) if
the requested hash algorithm is not one that the processor understands or if
the value or parameters are not appropriate for that algorithm.

Conformant processors must support "md" for version equal to "5" ([MD5]),
"sha" for version equal to "1" ([SHA1]) and "crc" for version equal to 32
[CRC32]. It is *implementation-defined<http://www.w3.org/XML/XProc/docs/langspec.html#dt-implementation-defined>
* what other algorithms are supported.

The matched nodes are specified with the match pattern in the match option.
For each matching node, the string value of the computed hash is used in the
output. Nodes that do not match are copied without change.

If the expression given in the match option matches an *attribute*, the hash
is used as the new value of the attribute in the output.

If the expression matches any other kind of node, the entire node (and
*not*just its contents) is replaced by the hash.

Mohamed


On Thu, May 1, 2008 at 11:53 AM, Innovimax SARL <innovimax@gmail.com> wrote:

> Please add reference to sha1 and md5 (RFC 1321) implementation
>
> Please change 'sha1' to 'sha' and add a version parameter which could be
> '0, '1', '256', '384', '512' (or any other number, but those are
> standardised)
>
> I should say the same for md5, but as md4 has never been in real use I'm
> ok with letting
>
> Another possitibility is to add an "p:option" with the name "version" to
> the p:hash step since almost all hashing algorithm have versions
>
> If we go that way I would rename "md5" to "md" and "sha1" to "sha" and say
> that
>
> (algorithm=md, version=5) and (algorithm=sha, version=1) are mandatory
>
> With the previous mail, I would propose those values :
>
> algorithm in (crc, md, sha, whirlpool & ripemd)
>
> Mohamed
>
> --
> Innovimax SARL
> Consulting, Training & XML Development
> 9, impasse des Orteaux
> 75020 Paris
> Tel : +33 9 52 475787
> Fax : +33 1 4356 1746
> http://www.innovimax.fr
> RCS Paris 488.018.631
> SARL au capital de 10.000 €




-- 
Innovimax SARL
Consulting, Training & XML Development
9, impasse des Orteaux
75020 Paris
Tel : +33 9 52 475787
Fax : +33 1 4356 1746
http://www.innovimax.fr
RCS Paris 488.018.631
SARL au capital de 10.000 €

Received on Saturday, 3 May 2008 13:56:37 UTC