Skip to content
Snippets Groups Projects
Select Git revision
  • c3b1e7363bffd898c84997e0ec32b15f8be45a96
  • master default protected
  • hpke
  • ppc-chacha-4core
  • delete-internal-name-mangling
  • master-updates
  • ppc-gcm
  • ppc-chacha-2core
  • refactor-ecc-mod
  • ppc-chacha-core
  • use-mpn_cnd-functions
  • optimize-ecc-invert
  • default-m4-quote-char
  • power-asm-wip
  • test-fat
  • chacha-3core-neon
  • x86_64-salsa20-2core
  • salsa20-2core-neon
  • bcrypt
  • arm-salsa20-chacha-vsra
  • test-shlib-dir
  • nettle_3.6_release_20200429
  • nettle_3.6rc3
  • nettle_3.6rc2
  • nettle_3.6rc1
  • nettle_3.5.1_release_20190627
  • nettle_3.5_release_20190626
  • nettle_3.5rc1
  • nettle_3.4.1_release_20181204
  • nettle_3.4.1rc1
  • nettle_3.4_release_20171119
  • nettle_3.4rc2
  • nettle_3.4rc1
  • nettle_3.3_release_20161001
  • nettle_3.2_release_20160128
  • nettle_3.1.1_release_20150424
  • nettle_3.1_release_20150407
  • nettle_3.1rc3
  • nettle_3.1rc2
  • nettle_3.1rc1
  • nettle_3.0_release_20140607
41 results

md5-meta.c

Blame
  • Forked from Nettle / nettle
    Source project has a limited visibility.
    • Niels Möller's avatar
      7699f2d5
      New files. · 7699f2d5
      Niels Möller authored
      Rev: src/nettle/hmac-md5.c:1.1
      Rev: src/nettle/hmac.c:1.1
      Rev: src/nettle/hmac.h:1.1
      Rev: src/nettle/md5-meta.c:1.1
      Rev: src/nettle/nettle-meta.h:1.1
      Rev: src/nettle/sha1-meta.c:1.1
      Rev: src/nettle/sha256-meta.c:1.1
      7699f2d5
      History
      New files.
      Niels Möller authored
      Rev: src/nettle/hmac-md5.c:1.1
      Rev: src/nettle/hmac.c:1.1
      Rev: src/nettle/hmac.h:1.1
      Rev: src/nettle/md5-meta.c:1.1
      Rev: src/nettle/nettle-meta.h:1.1
      Rev: src/nettle/sha1-meta.c:1.1
      Rev: src/nettle/sha256-meta.c:1.1
    sha1.c 12.68 KiB
    /* sha1.h
     *
     * The sha1 hash function.
     */
    
    /* nettle, low-level cryptographics library
     *
     * Copyright (C) 2001 Peter Gutmann, Andrew Kuchling, Niels Möller
     *  
     * The nettle library is free software; you can redistribute it and/or modify
     * it under the terms of the GNU Lesser General Public License as published by
     * the Free Software Foundation; either version 2.1 of the License, or (at your
     * option) any later version.
     * 
     * The nettle library 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 Lesser General Public
     * License for more details.
     * 
     * You should have received a copy of the GNU Lesser General Public License
     * along with the nettle library; see the file COPYING.LIB.  If not, write to
     * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
     * MA 02111-1307, USA.
     */
    
    /* Here's the first paragraph of Peter Gutmann's posting,
     * <30ajo5$oe8@ccu2.auckland.ac.nz>: 
     *
     * The following is my SHA (FIPS 180) code updated to allow use of the "fixed"
     * SHA, thanks to Jim Gillogly and an anonymous contributor for the information on
     * what's changed in the new version.  The fix is a simple change which involves
     * adding a single rotate in the initial expansion function.  It is unknown
     * whether this is an optimal solution to the problem which was discovered in the
     * SHA or whether it's simply a bandaid which fixes the problem with a minimum of
     * effort (for example the reengineering of a great many Capstone chips).
     */
    
    #include "sha1.h"
    
    #include "macros.h"
    
    #include <assert.h>
    #include <string.h>
    
    /* A block, treated as a sequence of 32-bit words. */
    #define SHA1_DATA_LENGTH 16
    
    /* The SHA f()-functions.  The f1 and f3 functions can be optimized to
       save one boolean operation each - thanks to Rich Schroeppel,
       rcs@cs.arizona.edu for discovering this */
    
    /* #define f1(x,y,z) ( ( x & y ) | ( ~x & z ) )            Rounds  0-19 */
    #define f1(x,y,z)   ( z ^ ( x & ( y ^ z ) ) )           /* Rounds  0-19 */
    #define f2(x,y,z)   ( x ^ y ^ z )                       /* Rounds 20-39 */
    /* #define f3(x,y,z) ( ( x & y ) | ( x & z ) | ( y & z ) ) Rounds 40-59 */
    #define f3(x,y,z)   ( ( x & y ) | ( z & ( x | y ) ) )   /* Rounds 40-59 */
    #define f4(x,y,z)   ( x ^ y ^ z )                       /* Rounds 60-79 */
    
    /* The SHA Mysterious Constants */
    
    #define K1  0x5A827999L                                 /* Rounds  0-19 */
    #define K2  0x6ED9EBA1L                                 /* Rounds 20-39 */
    #define K3  0x8F1BBCDCL                                 /* Rounds 40-59 */
    #define K4  0xCA62C1D6L                                 /* Rounds 60-79 */
    
    /* SHA initial values */
    
    #define h0init  0x67452301L
    #define h1init  0xEFCDAB89L
    #define h2init  0x98BADCFEL