OpenPrinting / cups

OpenPrinting CUPS Sources
https://openprinting.github.io/cups
Apache License 2.0
1.01k stars 182 forks source link

hash.c: Implement cupsHashData for OpenSSL #764

Closed zdohnal closed 1 year ago

zdohnal commented 1 year ago

Fixes #762 .

I've tried to compare results with hashes from GNUTLS:

Hashing "Hello world" by GNUTLS by all supported hashes:

Hash: md5
Final hash size: 16
>%�
y�ƛgL��g�,

Hash: sha
Final hash size: 20
{P,:H�`����c��9g?

Hash: sha2-224
Final hash size: 28
�#��w��n���Xd���

Hash: sha2-256
Final hash size: 32
d��

Hash: sha2-384
Final hash size: 48
�Ҙ�6'��Xx�c7��2���&P�諌'�3��ߔ��

Hash: sha2-512
Final hash size: 64
����킗�ۑtbO���i������&

Hash: sha2-512_224
Final hash size: 28
����킗�ۑtbO���i������&

Hash: sha2-512_256
Final hash size: 32
����킗�ۑtbO���i������&

Hashing by OpenSSL (OpenSSL supports those truncated algorithms by default, but it gives a different output...):

Hash: md5
Final hash size: 16
>%�
y�ƛgL��g�,

Hash: sha
Final hash size: 20
{P,:H�`����c��9g?

Hash: sha2-224
Final hash size: 28
�#��w��n���Xd���

Hash: sha2-256
Final hash size: 32
d��

Hash: sha2-384
Final hash size: 48
�Ҙ�6'��Xx�c7��2���&P�諌'�3��ߔ��

Hash: sha2-512
Final hash size: 64
����킗�ۑtbO���i������&

Hash: sha2-512_224
Final hash size: 28
�����g�O�[Y4/QO>F�����

Hash: sha2-512_256
Final hash size: 32
��XrԮ�h;���(�v�6/�Z���K��_

@michaelrsweet WDYT?

zdohnal commented 1 year ago

@michaelrsweet ok, I'll take the fix from libcups without breaking API (without two block hash feature).

zdohnal commented 1 year ago

This should be it.