comparison toys/lsb/md5sum.c @ 694:786841fdb1e0

Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style. The actual code should be the same afterward, this is just cosmetic refactoring.
author Rob Landley <rob@landley.net>
date Tue, 13 Nov 2012 17:14:08 -0600
parents 38e07dba9b20
children 5bdd2ee6f3c4
comparison
equal deleted inserted replaced
693:4a5a250e0633 694:786841fdb1e0
1 /* vi: set sw=4 ts=4: 1 /* md5sum.c - Calculate RFC 1321 md5 hash and sha1 hash.
2 *
3 * md5sum.c - Calculate RFC 1321 md5 hash and sha1 hash.
4 * 2 *
5 * Copyright 2012 Rob Landley <rob@landley.net> 3 * Copyright 2012 Rob Landley <rob@landley.net>
6 * 4 *
7 * See http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/md5sum.html 5 * See http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/md5sum.html
8 * and http://www.ietf.org/rfc/rfc1321.txt 6 * and http://www.ietf.org/rfc/rfc1321.txt
217 do { 215 do {
218 hash_update(&buf, 1, transform); 216 hash_update(&buf, 1, transform);
219 buf = 0; 217 buf = 0;
220 } while ((TT.count & 63) != 56); 218 } while ((TT.count & 63) != 56);
221 if (sha1) count=bswap_64(count); 219 if (sha1) count=bswap_64(count);
222 for (i = 0; i < 8; i++) 220 for (i = 0; i < 8; i++) TT.buffer.c[56+i] = count >> (8*i);
223 TT.buffer.c[56+i] = count >> (8*i);
224 transform(); 221 transform();
225 222
226 if (sha1) 223 if (sha1)
227 for (i = 0; i < 20; i++) 224 for (i = 0; i < 20; i++)
228 printf("%02x", 255&(TT.state[i>>2] >> ((3-(i & 3)) * 8))); 225 printf("%02x", 255&(TT.state[i>>2] >> ((3-(i & 3)) * 8)));