X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/dc2f0497fdfded94ef783b9a34943f26c85aba2b..813390c45f438f411662b1a55678e63f11681eb4:/sha.c diff --git a/sha.c b/sha.c index 2fe1846..157b81b 100644 --- a/sha.c +++ b/sha.c @@ -1,13 +1,13 @@ /* -*-c-*- * - * $Id: sha.c,v 1.2 1999/12/10 23:20:03 mdw Exp $ + * $Id: sha.c,v 1.4 2004/04/08 01:36:15 mdw Exp $ * * Implementation of the SHA-1 hash function * * (c) 1999 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of Catacomb. * @@ -15,29 +15,18 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * Catacomb is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with Catacomb; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: sha.c,v $ - * Revision 1.2 1999/12/10 23:20:03 mdw - * New hash interface requirements. - * - * Revision 1.1 1999/09/03 08:41:12 mdw - * Initial import. - * - */ - /*----- Header files ------------------------------------------------------*/ #include @@ -240,7 +229,7 @@ void sha_set(sha_ctx *ctx, const void *buf, unsigned long count) ctx->e = LOAD32(p + 16); ctx->off = 0; ctx->nl = U32(count); - ctx->nh = U32((count >> 16) >> 16); + ctx->nh = U32(((count & ~MASK32) >> 16) >> 16); } /* --- @sha_hash@ --- *