On 24.03.2012 10:26, Ruslan Nigmatullin wrote:
> Hello everybode,
> 
> Unicode characters are used in Complex Generation Example (Section 5.3 of 
> XEP), but looks like they are ignored in resulting hash value.
> I've tried to build the same string, coded it into utf-8 and to get SHA-1 
> hash for it and I got "XDu6S9Xwp17+ZL0Ug4CIuR36adI=", while hash in example 
> is "q07IKJEyjvHSyhy//CH0CxmKi8w=". To determine the reason I've played with 
> encodings and found that I receive the hash from example if verification 
> string is encoded by "latin-1" codec, which is possible invalid behaviour (as 
> original string contains non-latin symbols).
> 
> May be resulting hash should be fixed in example?
> 
> Ruslan

Hello Ruslan,

I tried to reproduce your results, but failed.
I can however reproduce the result from XEP-0115 just fine using both
openssl on the CLI and a SHA-1 implementation in Objective-C.

Here is the CLI version, which is IIRC also roughly what was used to
generate the original result in the XEP with an added "iconv" run to
make very sure the encoding is UTF-8:
% echo -n "client/pc/el/Ψ 0.11<client/pc/en/Psi 0.11<\
http://jabber.org/protocol/caps<http://jabber.org/protocol\
/disco#info<http://jabber.org/protocol/disco#items<http://jabber.org\
/protocol/muc<urn:xmpp:dataforms:softwareinfo<ip_version<ipv4<ipv6\
<os<Mac<os_version<10.5.1<software<Psi<software_version<0.11<" \
| iconv -t UTF-8 | openssl dgst -sha1 -binary | openssl base64
q07IKJEyjvHSyhy//CH0CxmKi8w=

It'd be interesting to hear how you got to your results.

Regards,
Florian Zeitz

Reply via email to