X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fsha1.c;h=d15325063d92b6e047ccfb438a7b683d4fb056ab;hb=88afc46984c143cbf928a3186f8cc93d819e9269;hp=1b2abb2f226a3b293a55347c5ec541b2cbc26f9e;hpb=8933f2145c15bb380f64998c11a05f67e3de83fb;p=wimlib diff --git a/src/sha1.c b/src/sha1.c index 1b2abb2f..d1532506 100644 --- a/src/sha1.c +++ b/src/sha1.c @@ -1,15 +1,21 @@ /* - * sha1.c + * sha1.c - implementation of the Secure Hash Algorithm version 1 (FIPS 180-1) * - * Implementation of the Secure Hash Algorithm version 1 (FIPS 180-1). + * The following copying information applies to this specific source code file: * - * Author: Eric Biggers - * Year: 2014 + * Written in 2014-2015 by Eric Biggers * - * The default SHA-1 transform is based on public domain code by Steve Reid. + * To the extent possible under law, the author(s) have dedicated all copyright + * and related and neighboring rights to this software to the public domain + * worldwide via the Creative Commons Zero 1.0 Universal Public Domain + * Dedication (the "CC0"). * - * The author dedicates this file to the public domain. - * You can do whatever you want with this file. + * This software 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 CC0 for more details. + * + * You should have received a copy of the CC0 along with this software; if not + * see . */ #ifdef HAVE_CONFIG_H @@ -51,7 +57,7 @@ sprint_hash(const u8 hash[SHA1_HASH_SIZE], tchar strbuf[SHA1_HASH_SIZE * 2 + 1]) #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) -#define blk0(i) (tmp[i] = be32_to_cpu(((const be32 *)block)[i])) +#define blk0(i) (tmp[i] = be32_to_cpu(load_be32_unaligned(&(block)[(i) * 4]))) #define blk(i) (tmp[i & 15] = rol(tmp[(i + 13) & 15] ^ \ tmp[(i + 8) & 15] ^ \