Skip to content
Snippets Groups Projects
Select Git revision
  • c251c1fc8e6b796e47eada2b835540484c2e9cab
  • 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

nettle-internal.h

Blame
  • Forked from Nettle / nettle
    Source project has a limited visibility.
    desQuick.c 1.03 KiB
    /*
     *	des - fast & portable DES encryption & decryption.
     *	Copyright (C) 1992  Dana L. How
     *	Please see the file `descore.README' for the complete copyright notice.
     *
     * Slightly edited by Niels Mller, 1997
     */
    
    #include "des.h"
    
    #include "RCSID.h"
    RCSID2(desQuick_cRcs, "$Id$");
    
    extern UINT32 des_keymap[];
    
    
    /* static information */
    
    static int depth = 0;		/* keep track of the request depth */
    UINT32 des_bigmap[0x4000];	/* big lookup table */
    
    /* fill in the 64k table used by the `quick' option */
    
    void
    DesQuickInit(void)
    {
    	int s1, s3, x;
    	UINT32 * t0, * t1, * t2, * t3;
    
    	if ( depth++ )
    		return;
    
    	t0 = des_bigmap;
    	t1 = t0 + 64;
    	t2 = t1 + 64;
    	t3 = t2 + 64;
    
    	for ( s3 = 63; s3 >= 0; s3-- ) {
    		for ( s1 = 63; s1 >= 0; s1-- ) {
    			x = (s3 << 8) | s1;
    			t0[x] = des_keymap[s3+128] ^ des_keymap[s1+192];
    			t1[x] = des_keymap[s3    ] ^ des_keymap[s1+ 64];
    			t2[x] = des_keymap[s3+384] ^ des_keymap[s1+448];
    			t3[x] = des_keymap[s3+256] ^ des_keymap[s1+320];
    		}
    	}
    }
    
    /* free the 64k table, if necessary */
    
    void
    DesQuickDone(void)
    {
    }