md5.c
changeset 162 fad55be2d07c
parent 148 8a5cf98a00b6
equal deleted inserted replaced
161:36f763c8ab16 162:fad55be2d07c
    27     }
    27     }
    28 
    28 
    29     /*
    29     /*
    30      * MD5 alters the input buffer
    30      * MD5 alters the input buffer
    31      */
    31      */
    32     strncpy (buffer, argv[1], sizeof (buffer));
    32     strncpy (buffer, argv[1], sizeof (buffer) - 1);
    33     strncpy (text, argv[1], sizeof (buffer));
    33     strncpy (text, argv[1], sizeof (text) - 1);
    34 
    34 
    35     md5_hash = MD5 ((u_char *) buffer, strlen (buffer), NULL);
    35     md5_hash = MD5 ((u_char *) buffer, strlen (buffer), NULL);
    36 
    36 
    37     for (i = 0, j = 0; i < 16; i++) {
    37     for (i = 0, j = 0; i < 16; i++) {
    38         sprintf (byte, "%02x", (md5_hash[i] & 0xFF));
    38         sprintf (byte, "%02x", (md5_hash[i] & 0xFF));