Re: [dev] [sbase] [patch v2] Add md5sum

From: Szabolcs Nagy <nsz_AT_port70.net>
Date: Wed, 19 Jun 2013 12:51:33 +0200

* stateless <stateless_AT_archlinux.us> [2013-06-19 11:38:00 +0100]:
> This is a version of md5sum(1) using the md5 routines from 9base - slightly
> adapted to compile.
>

be careful with integer arithmetics in crypto code

your code invokes undefined behaviour because of
signed int overflow:

 unsigned f(unsigned char c) { return c<<24; }

c is promoted to int not unsigned in the left shift

it will work in practice (usually) but that's only
by accident

you should cast c to the right type
Received on Wed Jun 19 2013 - 12:51:33 CEST

This archive was generated by hypermail 2.3.0 : Wed Jun 19 2013 - 13:00:07 CEST