folder Tahribat.com Forumları
linefolder Bilişim Güvenliği
linefolder C Dilinde Hazırlanan Kriptoloji Algoritmaları İle İlgili Programlar...



C Dilinde Hazırlanan Kriptoloji Algoritmaları İle İlgili Programlar...

  1. KısayolKısayol reportŞikayet pmÖzel Mesaj
    daralgeldi
    daralgeldi's avatar
    Kayıt Tarihi: 27/Mart/2007
    Erkek

    DES ŞİFRELEME METODU

     

    #include "DES.h"

     

    static const uint8_t InitialPermuteMap[64] =

      {

      57, 49, 41, 33, 25, 17,  9, 1,

      59, 51, 43, 35, 27, 19, 11, 3,

      61, 53, 45, 37, 29, 21, 13, 5,

      63, 55, 47, 39, 31, 23, 15, 7,

      56, 48, 40, 32, 24, 16,  8, 0,

      58, 50, 42, 34, 26, 18, 10, 2,

      60, 52, 44, 36, 28, 20, 12, 4,

      62, 54, 46, 38, 30, 22, 14, 6

      };

     

     

    static const uint8_t KeyPermuteMap[56] =

      {

      49, 42, 35, 28, 21, 14,  7,  0,

      50, 43, 36, 29, 22, 15,  8,  1,

      51, 44, 37, 30, 23, 16,  9,  2,

      52, 45, 38, 31, 55, 48, 41, 34,

      27, 20, 13,  6, 54, 47, 40, 33,

      26, 19, 12,  5, 53, 46, 39, 32,

      25, 18, 11,  4, 24, 17, 10,  3,

      };

     

     

    static const uint8_t KeyRotation[16] =

      { 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 };

     

     

    static const uint8_t KeyCompression[48] =

      {

      13, 16, 10, 23,  0,  4,  2, 27,

      14,  5, 20,  9, 22, 18, 11,  3,

      25,  7, 15,  6, 26, 19, 12,  1,

      40, 51, 30, 36, 46, 54, 29, 39,

      50, 44, 32, 47, 43, 48, 38, 55,

      33, 52, 45, 41, 49, 35, 28, 31

      };

     

     

    static const uint8_t DataExpansion[48] =

      {

      31,  0,  1,  2,  3,  4,  3,  4,

       5,  6,  7,  8,  7,  8,  9, 10,

      11, 12, 11, 12, 13, 14, 15, 16,

      15, 16, 17, 18, 19, 20, 19, 20,

      21, 22, 23, 24, 23, 24, 25, 26,

      27, 28, 27, 28, 29, 30, 31,  0

      };

     

     

    static const uint8_t SBox[8][64] =

      {

        {  /* S0 */

        14,  0,  4, 15, 13,  7,  1,  4,  2, 14, 15,  2, 11, 13,  8,  1,

         3, 10, 10,  6,  6, 12, 12, 11,  5,  9,  9,  5,  0,  3,  7,  8,

         4, 15,  1, 12, 14,  8,  8,  2, 13,  4,  6,  9,  2,  1, 11,  7,

        15,  5, 12, 11,  9,  3,  7, 14,  3, 10, 10,  0,  5,  6,  0, 13

        },

        {  /* S1 */

        15,  3,  1, 13,  8,  4, 14,  7,  6, 15, 11,  2,  3,  8,  4, 14,

         9, 12,  7,  0,  2,  1, 13, 10, 12,  6,  0,  9,  5, 11, 10,  5,

         0, 13, 14,  8,  7, 10, 11,  1, 10,  3,  4, 15, 13,  4,  1,  2,

         5, 11,  8,  6, 12,  7,  6, 12,  9,  0,  3,  5,  2, 14, 15,  9

        },

        {  /* S2 */

        10, 13,  0,  7,  9,  0, 14,  9,  6,  3,  3,  4, 15,  6,  5, 10,

         1,  2, 13,  8, 12,  5,  7, 14, 11, 12,  4, 11,  2, 15,  8,  1,

        13,  1,  6, 10,  4, 13,  9,  0,  8,  6, 15,  9,  3,  8,  0,  7,

        11,  4,  1, 15,  2, 14, 12,  3,  5, 11, 10,  5, 14,  2,  7, 12

        },

        {  /* S3 */

         7, 13, 13,  8, 14, 11,  3,  5,  0,  6,  6, 15,  9,  0, 10,  3,

         1,  4,  2,  7,  8,  2,  5, 12, 11,  1, 12, 10,  4, 14, 15,  9,

        10,  3,  6, 15,  9,  0,  0,  6, 12, 10, 11,  1,  7, 13, 13,  8,

        15,  9,  1,  4,  3,  5, 14, 11,  5, 12,  2,  7,  8,  2,  4, 14

        },

        {  /* S4 */

         2, 14, 12, 11,  4,  2,  1, 12,  7,  4, 10,  7, 11, 13,  6,  1,

         8,  5,  5,  0,  3, 15, 15, 10, 13,  3,  0,  9, 14,  8,  9,  6,

         4, 11,  2,  8,  1, 12, 11,  7, 10,  1, 13, 14,  7,  2,  8, 13,

        15,  6,  9, 15, 12,  0,  5,  9,  6, 10,  3,  4,  0,  5, 14,  3

        },

        {  /* S5 */

        12, 10,  1, 15, 10,  4, 15,  2,  9,  7,  2, 12,  6,  9,  8,  5,

         0,  6, 13,  1,  3, 13,  4, 14, 14,  0,  7, 11,  5,  3, 11,  8,

         9,  4, 14,  3, 15,  2,  5, 12,  2,  9,  8,  5, 12, 15,  3, 10,

         7, 11,  0, 14,  4,  1, 10,  7,  1,  6, 13,  0, 11,  8,  6, 13

        },

        {  /* S6 */

         4, 13, 11,  0,  2, 11, 14,  7, 15,  4,  0,  9,  8,  1, 13, 10,

         3, 14, 12,  3,  9,  5,  7, 12,  5,  2, 10, 15,  6,  8,  1,  6,

         1,  6,  4, 11, 11, 13, 13,  8, 12,  1,  3,  4,  7, 10, 14,  7,

        10,  9, 15,  5,  6,  0,  8, 15,  0, 14,  5,  2,  9,  3,  2, 12

        },

        {  /* S7 */

        13,  1,  2, 15,  8, 13,  4,  8,  6, 10, 15,  3, 11,  7,  1,  4,

        10, 12,  9,  5,  3,  6, 14, 11,  5,  0,  0, 14, 12,  9,  7,  2,

         7,  2, 11,  1,  4, 14,  1,  7,  9,  4, 12, 10, 14,  8,  2, 13,

         0, 15,  6, 12, 10,  9, 13,  0, 15,  3,  3,  5,  5,  6,  8, 11

        }

      };

     

     

    static const uint8_t PBox[32] =

      {

      15,  6, 19, 20, 28, 11, 27, 16,

       0, 14, 22, 25,  4, 17, 30,  9,

       1,  7, 23, 13, 31, 26,  2,  8,

      18, 12, 29,  5, 21, 10,  3, 24

      };

     

     

    static const uint8_t FinalPermuteMap[64] =

      {

       7, 39, 15, 47, 23, 55, 31, 63,

       6, 38, 14, 46, 22, 54, 30, 62,

       5, 37, 13, 45, 21, 53, 29, 61,

       4, 36, 12, 44, 20, 52, 28, 60,

       3, 35, 11, 43, 19, 51, 27, 59,

       2, 34, 10, 42, 18, 50, 26, 58,

       1, 33,  9, 41, 17, 49, 25, 57,

       0, 32,  8, 40, 16, 48, 24, 56

      };

     

     

    #define CLRBIT( STR, IDX ) ( (STR)[(IDX)/8] &= ~(0x01 << (7 - ((IDX)%8))) )

     

    #define SETBIT( STR, IDX ) ( (STR)[(IDX)/8] |= (0x01 << (7 - ((IDX)%8))) )

     

    #define GETBIT( STR, IDX ) (( ((STR)[(IDX)/8]) >> (7 - ((IDX)%8)) ) & 0x01)

     

    static void Permute( uchar *dst,

                   const uchar *src,

                   const uint8_t *map,

                   const int mapsize )

      {

      int bitcount;

      int i;

      for( i = 0; i < mapsize; i++ )

        dst[i] = 0;

     

        bitcount = mapsize * 8;

      for( i = 0; i < bitcount; i++ )

        {

        if( GETBIT( src, map[i] ) )

          SETBIT( dst, i );

        }

      }

     

     

    static void KeyShift( uchar *key, const int numbits )

      {

      int   i;

      uchar keep = key[0];   

      

      for( i = 0; i < numbits; i++ )

        {

        int j;

     

        /* Shift the entire thing, byte by byte.

         */

        for( j = 0; j < 7; j++ )

          {

          if( j && (key[j] & 0x80) ) 

            key[j-1] |=  0x01;       

          key[j] <<= 1;              

          }

     

        if( GETBIT( key, 27 ) )    

          {

          CLRBIT( key, 27 );       

          SETBIT( key, 55 );       

          }

     

        if( keep & 0x80 )

          SETBIT( key, 27 );

     

       

        keep <<= 1;

        }

      }

     

     

    static void sbox( uchar *dst, const uchar *src )

     

      {

      int i;

      for( i = 0; i < 4; i++ )

        dst[i] = 0;

     

      for( i = 0; i < 8; i++ )

        {

        int j;

        int Snum;

        int bitnum;

     

        for( Snum = j = 0, bitnum = (i * 6); j < 6; j++, bitnum++ )

          {

          Snum <<= 1;

          Snum  |= GETBIT( src, bitnum );

          }

     

        if( 0 == (i%2) )

          dst[i/2] |= ((SBox[i][Snum]) << 4);

        else

          dst[i/2] |= SBox[i][Snum];

        }

      }

     

     

    static void xor( uchar *dst, const uchar *a, const uchar *b, const int count )

      {

      int i;

     

      for( i = 0; i < count; i++ )

        dst[i] = a[i] ^ b[i];

      }

     

     

    uchar *auth_DESkey8to7( uchar *dst, const uchar *key )

        {

      int i;

      uchar tmp[7];

      static const uint8_t map8to7[56] =

        {

         0,  1,  2,  3,  4,  5,  6,

         8,  9, 10, 11, 12, 13, 14,

        16, 17, 18, 19, 20, 21, 22,

        24, 25, 26, 27, 28, 29, 30,

        32, 33, 34, 35, 36, 37, 38,

        40, 41, 42, 43, 44, 45, 46,

        48, 49, 50, 51, 52, 53, 54,

        56, 57, 58, 59, 60, 61, 62

        };

     

      if( (NULL == dst) || (NULL == key) )

        return( NULL );

     

      Permute( tmp, key, map8to7, 7 );

      for( i = 0; i < 7; i++ )

        dst[i] = tmp[i];

     

      return( dst );

      }

     

     

    uchar *auth_DEShash( uchar *dst, const uchar *key, const uchar *src )

     

      {

      int   i;         

      uchar K[7];      

      uchar D[8];      

     

     

      Permute( K, key, KeyPermuteMap, 7 );

      Permute( D, src, InitialPermuteMap, 8 );

     

     

      for( i = 0; i < 16; i++ )

        {

        int    j;

        uchar *L = D;              

        uchar *R = &(D[4]);         

        uchar  Rexp[6];        

        uchar  Rn[4];              

        uchar  SubK[6];        

        KeyShift( K, KeyRotation[i] );

        Permute( SubK, K, KeyCompression, 6 );

     

       

        Permute( Rexp, R, DataExpansion, 6 );

        xor( Rexp, Rexp, SubK, 6 );

     

       

        sbox( Rn, Rexp );

        Permute( Rexp, Rn, PBox, 4 );

        xor( Rn, L, Rexp, 4 );

     

       

        for( j = 0; j < 4; j++ )

          {

          L[j] = R[j];

          R[j] = Rn[j];

          }

        }

     

     

      Permute( dst, D, FinalPermuteMap, 8 );

      return( dst );

      }


    //D@R@L63LD! the Certified Java Architecture...
  2. KısayolKısayol reportŞikayet pmÖzel Mesaj
    daralgeldi
    daralgeldi's avatar
    Kayıt Tarihi: 27/Mart/2007
    Erkek

    VİGENERE ŞİFRELEME METODU

     

     

    #include <stdio.h>

     

    #define ALPHA        26    

    #define MAXKEYLENGTH 10    

    #define BLOCKLENGTH   5    

    #define LINELENGTH   80    

     

    char key[MAXKEYLENGTH+1];  

    int  blockcount = 0;       

    int  linechars = 0;        

    int  keylength = 0;        

    int  vigenere=0,beauford=0,varbeau=0;

                               

    FILE *fp;                  

     

    void getsetup(void)

    {

      char ch;                 

      char *tmp = key;         

     

      ch = getc(fp);

      if (ch == 'V' || ch == 'v')         vigenere = 1;

      else if (ch == 'B' || ch == 'b')    beauford = 1;

      else if (ch == 'A' || ch == 'a')    varbeau  = 1;

      else {

        fprintf(stderr,"V/B/A ciphers only - Vigenere assumed\n");

        vigenere = 1;

      }

     

      while ((ch = getc(fp)) != '\n'); 

     

     

     

      for (keylength=0; keylength < MAXKEYLENGTH; keylength++)

        if ((key[keylength]= getc(fp)) == '\n') break;

     

      if (key[keylength] != '\n') {

        while ((ch = getc(fp)) != '\n');

        fprintf(stderr,"Key truncated to %d characters\n", keylength);

      }

    }

     

    int encipher(int i)

    {

     

     

      char ch;                 

      int tmp;                 

     

      ch = getc(fp);

      if (ch >= 'A' && ch <= 'Z') { 

        ch = ch - 'A' + 'a';        

      }

      if (ch >= 'a' && ch <= 'z') { 

        if (vigenere)

          tmp = (ch + key[i] - 2*'a') % ALPHA;

        else if (beauford)

          tmp = (key[i] - ch) % ALPHA;

        else

          tmp = (ch - key[i]) % ALPHA;

     

        while (tmp < 0) tmp += ALPHA;

        tmp += 'a';

      }

      else tmp = ch;        

      return(tmp);

    }

     

    void outputcipher(void)

    {

      int cipherch, i=0;                

      while (!feof(fp)) {            

        cipherch = encipher(i); 

        if (cipherch < 'a' || cipherch > 'z')

          continue;             

       

        if (i == keylength-1)   i=0;

        else                   i++;

     

       

        if (blockcount == BLOCKLENGTH) {

          if (linechars > LINELENGTH - BLOCKLENGTH) {

            putchar('\n');

            linechars = 0;

          }

          else {

            putchar(' ');

            linechars++;

          }

          blockcount = 0;

        }

        putchar(cipherch);

        blockcount++;

        linechars++;

      }

      putchar('\n');

    }

     

    void main(void)

    {

      fp = stdin;

      getsetup();

      outputcipher();

    }

    void main(int argc, char *argv[])

    {

      if (argc != 2) {

        fprintf(stderr, "Usage: program <input_file>\n");

        exit(1);

      }

     

      if ((fp = fopen(argv[1],"r")) == NULL) {

        fprintf(stderr, "File %s cannot be read from\n", argv[1]);

        exit(1);

      }

     

      getsetup();

      outputcipher();

    }


    //D@R@L63LD! the Certified Java Architecture...
  3. KısayolKısayol reportŞikayet pmÖzel Mesaj
    daralgeldi
    daralgeldi's avatar
    Kayıt Tarihi: 27/Mart/2007
    Erkek

    MD4 ŞİFRELEME METODU

     

    #include "MD4.h"

     

     

    static const uint8_t Round2_k[] =

      {

      0, 4,  8, 12,

      1, 5,  9, 13,

      2, 6, 10, 14,

      3, 7, 11, 15

      };

     

    static const uint8_t Round3_k[] =

      {

      0,  8, 4, 12,

      2, 10, 6, 14,

      1,  9, 5, 13,

      3, 11, 7, 15

      };

     

    static const uint8_t S[3][4] =

      {

        { 3, 7, 11, 19 },   /* round 0 */

        { 3, 5,  9, 13 },   /* round 1 */

        { 3, 9, 11, 15 }    /* round 2 */

      };

     

     

    #define md4F( X, Y, Z ) ( ((X) & (Y)) | ((~(X)) & (Z)) )

    #define md4G( X, Y, Z ) ( ((X) & (Y)) | ((X) & (Z)) | ((Y) & (Z)) )

    #define md4H( X, Y, Z ) ( (X) ^ (Y) ^ (Z) )

     

    #define GetLongByte( L, idx ) ((uchar)(( L >> (((idx) & 0x03) << 3) ) & 0xFF))

     

    static void Permute( uint32_t ABCD[4], const uchar block[64] )

      {

      int      round;

      int      i, j;

      uint8_t  s;

      uint32_t a, b, c, d;

      uint32_t KeepABCD[4];

      uint32_t X[16];

     

      for( i = 0; i < 4; i++ )

        KeepABCD[i] = ABCD[i];

     

      for( i = 0, j = 0; i < 16; i++ )

        {

        X[i]  =  (uint32_t)block[j++];

        X[i] |= ((uint32_t)block[j++] << 8);

        X[i] |= ((uint32_t)block[j++] << 16);

        X[i] |= ((uint32_t)block[j++] << 24);

        }

      for( round = 0; round < 3; round++ )

        {

        for( i = 0; i < 16; i++ )

          {

          j = (4 - (i % 4)) & 0x3; 

          s = S[round][i%4];       

          b = ABCD[(j+1) & 0x3];   

          c = ABCD[(j+2) & 0x3];   

          d = ABCD[(j+3) & 0x3];   

     

          switch( round )

            {

            case 0:

              a = md4F( b, c, d ) + X[i];

              break;

            case 1:

              a = md4G( b, c, d ) + X[ Round2_k[i] ] + 0x5A827999;

              break;

            default:

              a = md4H( b, c, d ) + X[ Round3_k[i] ] + 0x6ED9EBA1;

              break;

            }

          a = 0xFFFFFFFF & ( ABCD[j] + a );

          ABCD[j] = 0xFFFFFFFF & (( a << s ) | ( a >> (32 - s) ));

          }

        }

     

      for( i = 0; i < 4; i++ )

        ABCD[i] = 0xFFFFFFFF & ( ABCD[i] + KeepABCD[i] );

     

      }

     

     

    uchar *auth_md4Sum( uchar *dst, const uchar *src, const int srclen )

      {

      uchar    block[64]; 

      int      i;

      uint32_t l;

      uint32_t m;

      uint32_t len = (uint32_t)srclen;

      uint32_t ABCD[4] = 

        {                

        0x67452301,      

        0xefcdab89,      

        0x98badcfe,      

        0x10325476       

        };               

                         

        m = len & ~(uint32_t)63;       

      for( l = 0; l < m; l += 64 )

        {

        Permute( ABCD, &src[l] );

        }

     

      for( i = 0; i < 64; i++, l++ )

        {

        if( l < len )

          block[i] = src[l];       

        else

          {

          if( l == len )

            block[i] = 0x80;       

          else /* l > len */

            block[i] = 0;           

          }

        }

     

     

     

      if( (l - len) <= 8 )         

        {

        Permute( ABCD, block );

        for( i = 0; i < 64; i++ )  

          block[i] = 0;

        }

     

      l = len << 3;

      for( i = 0; i < 4; i++ )

        block[56+i] |= GetLongByte( l, i );

      block[60] = ((GetLongByte( len, 3 ) & 0xE0) >> 5); 

      Permute( ABCD, block );

     

      for( i = 0; i < 4; i++ )

        {

        dst[ 0+i] = GetLongByte( ABCD[0], i );

        dst[ 4+i] = GetLongByte( ABCD[1], i );

        dst[ 8+i] = GetLongByte( ABCD[2], i );

        dst[12+i] = GetLongByte( ABCD[3], i );

        }

     

      return( dst );

      }


    //D@R@L63LD! the Certified Java Architecture...
  4. KısayolKısayol reportŞikayet pmÖzel Mesaj
    daralgeldi
    daralgeldi's avatar
    Kayıt Tarihi: 27/Mart/2007
    Erkek

    MD5 ŞİFRELEME METODU

     

    #include "MD5.h"

     

    static const uint8_t K[3][16] =

      {

        {  1,  6, 11,  0,  5, 10, 15,  4,  9, 14,  3,  8, 13,  2,  7, 12 }, /* R2 */

        {  5,  8, 11, 14,  1,  4,  7, 10, 13,  0,  3,  6,  9, 12, 15,  2 }, /* R3 */

        {  0,  7, 14,  5, 12,  3, 10,  1,  8, 15,  6, 13,  4, 11,  2,  9 }  /* R4 */

      };

     

    static const uint8_t S[4][4] =

      {

        { 7, 12, 17, 22 }, 

        { 5,  9, 14, 20 }, 

        { 4, 11, 16, 23 }, 

        { 6, 10, 15, 21 }  

      };

     

     

    static const uint32_t T[4][16] =

      {

        { 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,  

          0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,

          0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,

          0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821 },

     

        { 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,  

          0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,

          0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,

          0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a },

     

        { 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,  

          0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,

          0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05,

          0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665 },

     

        { 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039,  

          0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,

          0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,

          0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 },

      };

     

     

    #define md5F( X, Y, Z ) ( ((X) & (Y)) | ((~(X)) & (Z)) )

    #define md5G( X, Y, Z ) ( ((X) & (Z)) | ((Y) & (~(Z))) )

    #define md5H( X, Y, Z ) ( (X) ^ (Y) ^ (Z) )

    #define md5I( X, Y, Z ) ( (Y) ^ ((X) | (~(Z))) )

     

    #define GetLongByte( L, idx ) ((uchar)(( L >> (((idx) & 0x03) << 3) ) & 0xFF))

     

     

    static void Permute( uint32_t ABCD[4], const uchar block[64] )

      {

      int      round;

      int      i, j;

      uint8_t  s;

      uint32_t a, b, c, d;

      uint32_t KeepABCD[4];

      uint32_t X[16];

     

      for( i = 0; i < 4; i++ )

        KeepABCD[i] = ABCD[i];

     

      for( i = 0, j = 0; i < 16; i++ )

        {

        X[i]  =  (uint32_t)block[j++];

        X[i] |= ((uint32_t)block[j++] << 8);

        X[i] |= ((uint32_t)block[j++] << 16);

        X[i] |= ((uint32_t)block[j++] << 24);

        }

      for( round = 0; round < 4; round++ )

        {

        for( i = 0; i < 16; i++ )

          {

          j = (4 - (i % 4)) & 0x3; 

          s = S[round][i%4];       

     

          b = ABCD[(j+1) & 0x3];   

          c = ABCD[(j+2) & 0x3];   

          d = ABCD[(j+3) & 0x3];   

          switch( round )

            {

            case 0:

              a = md5F( b, c, d ) + X[i];

              break;

            case 1:

              a = md5G( b, c, d ) + X[ K[0][i] ];

              break;

            case 2:

              a = md5H( b, c, d ) + X[ K[1][i] ];

              break;

            default:

              a = md5I( b, c, d ) + X[ K[2][i] ];

              break;

            }

          a = 0xFFFFFFFF & ( ABCD[j] + a + T[round][i] );

          ABCD[j] = b + (0xFFFFFFFF & (( a << s ) | ( a >> (32 - s) )));

          }

        }

     

      for( i = 0; i < 4; i++ )

        ABCD[i] = 0xFFFFFFFF & ( ABCD[i] + KeepABCD[i] );

     

      }

     

     

    auth_md5Ctx *auth_md5InitCtx( auth_md5Ctx *ctx )

      {

      ctx->len     = 0;

      ctx->b_used  = 0;

     

      ctx->ABCD[0] = 0x67452301;   

      ctx->ABCD[1] = 0xefcdab89;   

      ctx->ABCD[2] = 0x98badcfe;   

      ctx->ABCD[3] = 0x10325476;   

                                   

      return( ctx );

      }

     

     

    auth_md5Ctx *auth_md5SumCtx( auth_md5Ctx *ctx,

                                 const uchar *src,

                                 const int    len )

      {

      int i;

     

      ctx->len += (uint32_t)len;

     

      for( i = 0; i < len; i++ )

        {

        ctx->block[ ctx->b_used ] = src[i];

        (ctx->b_used)++;

        if( 64 == ctx->b_used )

          {

          Permute( ctx->ABCD, ctx->block );

          ctx->b_used = 0;

          }

        }

     

      return( ctx );

      }

     

     

    auth_md5Ctx *auth_md5CloseCtx( auth_md5Ctx *ctx, uchar *dst )

      {

      int      i;

      uint32_t l;

     

      ctx->block[ctx->b_used] = 0x80;

      (ctx->b_used)++;

     

      for( i = ctx->b_used; i < 64; i++ )

        ctx->block[i] = 0;

     

      if( 56 < ctx->b_used )

        {

        Permute( ctx->ABCD, ctx->block );

        for( i = 0; i < 64; i++ )

          ctx->block[i] = 0;

        }

     

      l = ctx->len << 3;

      for( i = 0; i < 4; i++ )

        ctx->block[56+i] |= GetLongByte( l, i );

      ctx->block[60] = ((GetLongByte( ctx->len, 3 ) & 0xE0) >> 5); 

      Permute( ctx->ABCD, ctx->block );

     

      for( i = 0; i < 4; i++ )

        {

        dst[ 0+i] = GetLongByte( ctx->ABCD[0], i );

        dst[ 4+i] = GetLongByte( ctx->ABCD[1], i );

        dst[ 8+i] = GetLongByte( ctx->ABCD[2], i );

        dst[12+i] = GetLongByte( ctx->ABCD[3], i );

        }

     

      return( ctx );

      } /* auth_md5CloseCtx */

     

     

    uchar *auth_md5Sum( uchar *dst, const uchar *src, const int len )

      {

      auth_md5Ctx ctx[1];

     

      (void)auth_md5InitCtx( ctx );            

      (void)auth_md5SumCtx( ctx, src, len );   

      (void)auth_md5CloseCtx( ctx, dst );      

     

      return( dst );                           

      }

     

     

    NOT: Ek olarak istediğiniz başka algoritmalar ve programları ile ilgili istekleriniz ve önerilerinizi bekliorum...


    //D@R@L63LD! the Certified Java Architecture...
  5. KısayolKısayol reportŞikayet pmÖzel Mesaj
    Tayok
    Tayok's avatar
    Kayıt Tarihi: 04/Mart/2007
    Erkek
    Hoca şunları metin belgesine atıp dosya paylaşım sitelerine yükleseydin daha iyi olurdu. Millet az sonra saldırır sana bak görürsün :)
  6. KısayolKısayol reportŞikayet pmÖzel Mesaj
    daralgeldi
    daralgeldi's avatar
    Kayıt Tarihi: 27/Mart/2007
    Erkek
    wallane anlamda saldırcaklar anlamadım ama milletim burda görüp kodları denemeleri daha kolay olur die düşünüorum...

    //D@R@L63LD! the Certified Java Architecture...
  7. KısayolKısayol reportŞikayet pmÖzel Mesaj
    Esquire
    Esquire's avatar
    Kayıt Tarihi: 10/Mart/2004
    Erkek

    bunları nasıl deneyeceğiz?:S

     


    boş
  8. KısayolKısayol reportŞikayet pmÖzel Mesaj
    daralgeldi
    daralgeldi's avatar
    Kayıt Tarihi: 27/Mart/2007
    Erkek
    c compiler da yazıp çalıştırırsan denemiş olursun :D

    //D@R@L63LD! the Certified Java Architecture...
  9. KısayolKısayol reportŞikayet pmÖzel Mesaj
    rappermcs
    rappermcs's avatar
    Kayıt Tarihi: 04/Ekim/2002
    Erkek

    Esquire bunu yazdı:
    -----------------------------

    bunları nasıl deneyeceğiz?:S

     


    -----------------------------

     

     C ye bu kodları yas kayedet çalıştır  :)



    Paslanmış bir uygulama geliştirici.. #AnalistŞart
  10. KısayolKısayol reportŞikayet pmÖzel Mesaj
    majestiquo
    majestiquo's avatar
    Kayıt Tarihi: 24/Eylül/2005
    Erkek

    Vigenere için c# örnek kodları : http://rapidshare.com/files/167581273/Vigenere.rar.html

    Bi zamanlar ödev için yapmıştık belki lazım olur :)

  11. KısayolKısayol reportŞikayet pmÖzel Mesaj
    EntelKoylu
    EntelKoylu's avatar
    Kayıt Tarihi: 13/Eylül/2005
    Erkek
    Vigenere için c# örnek kodları : http://rapidshare.com/files/167581273/Vigenere.rar.html şunun linklerni sna verebilirmi

    Bi zamanlar ödev için yapmıştık belki lazım olur :)

    ---------------------------------------------------------------------

    Linki yenilermisin hocam?


    ANDY // Burası mezopotamya, küresel oyunun bumerang cehennemi. Tanrı bile dünya düzeni için peygamberlerini hep buraya göndermiş. Çünkü burası aslında yeryüzü cennetiymiş. Daha Fazla Bilgi İçin Profilimi İnceleyiniz...
Toplam Hit: 13228 Toplam Mesaj: 11