[Standards] XEP-0153: Encoding of photo hash?
christian.schudt at gmx.de
Sun Feb 25 20:02:07 UTC 2018
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:
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.
> Am 25.02.2018 um 20:45 schrieb Tedd Sterr <teddsterr at outlook.com>:
> 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 ."
> <presence from='juliet at capulet.com/balcony'>
> <x xmlns='vcard-temp:x:update'>
> 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 <standards-bounces at xmpp.org> on behalf of Christian Schudt <christian.schudt at gmx.de>
> 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: Standards-unsubscribe at xmpp.org
More information about the Standards