For me the text and examples are not clear.

„sha1-hash-of-image“ in the example doesn’t say anything about the encoding.

And „not the base64-encoded version“ reads as:

Don’t do

byte[] hash = sha1(base64(image_bytes));

but instead do

byte[] hash = sha1(image_bytes);

It still doesn’t say anything about how to encode the byte array hash in XML.

Seems like base64 encoding is not used.

Jonas, I have no objections to clarify the usage of lower-case hex encoding.

—Christian


> Am 25.02.2018 um 20:45 schrieb Tedd Sterr <[email protected]>:
> 
> Igonre the schema - it doesn't appear to be complete or correct. The text & 
> examples make it clear:
> 
> 
> "the user's client computes the SHA1 hash of the avatar image data itself 
> (not the base64-encoded version) in accordance with RFC 3174 [4]."
> 
> <presence from='[email protected]/balcony'>
>   <x xmlns='vcard-temp:x:update'>
>     <photo>sha1-hash-of-image</photo>
>   </x>
> </presence>
> 
> 
> The hash value is the hexadecimal representation of the SHA1 digest (40 
> characters, representing 20 bytes.)
> ('not the base64-encoded version' means the hash is calculated from the raw 
> image data, not the base64 version that will be sent.)
> 
> The image data is the base64 encoded binary content of the image file.
> 
> "The <PHOTO/> element SHOULD contain a <BINVAL/> child whose XML character 
> data is Base64-encoded data for the avatar image."
> 
> 
> I've never seen any examples to the contrary; and I suspect no receiving 
> clients would support any such deviations.
> 
> 
> 
> From: Standards <[email protected]> on behalf of Christian Schudt 
> <[email protected]>
> Sent: 24 February 2018 19:22
> To: XMPP Standards
> Subject: [Standards] XEP-0153: Encoding of photo hash?
>  
> Hi list,
> 
> I’ve got a question about XEP-0153. Its XML schema defines that the photo 
> hash is encoded as Base64:
> 
> <xs:element name='photo' minOccurs='0' type='xs:base64Binary‘/>
> 
> However, I’ve seen the hash encoded as hexadecimal, too. It was no small 
> client, but it was Facebook.
> I don’t know how other clients behave.
> 
> So I wonder, what is the correct encoding of the photo hash value: base64 or 
> hex-encoded?
> 
> Kind regards,
> — Christian
> _______________________________________________
> Standards mailing list
> Info: https://mail.jabber.org/mailman/listinfo/standards
> Unsubscribe: [email protected]
> _______________________________________________

_______________________________________________
Standards mailing list
Info: https://mail.jabber.org/mailman/listinfo/standards
Unsubscribe: [email protected]
_______________________________________________

Reply via email to