Changeset 1bdc669 for unix.c


Ignore:
Timestamp:
2023-02-23T23:48:10Z (19 months ago)
Author:
GitHub <noreply@…>
Branches:
master
Children:
93d4d8f
Parents:
7342cae
git-author:
Jelmer Vernooij <jelmer@…> (23-02-23 23:48:10)
git-committer:
GitHub <noreply@…> (23-02-23 23:48:10)
Message:

Migrate internal users of md5.h to using GChecksum directly (#169)

  • Use GChecksum directly rather than md5 wrapper
  • Mark md5 functions as deprecated.
  • Migrate more users of md5.h to GChecksum
File:
1 edited

Legend:

Unmodified
Added
Removed
  • unix.c

    r7342cae r1bdc669  
    261261                g_free(pass_cl);
    262262        } else if (strcmp(argv[2], "hash") == 0) {
    263                 md5_byte_t pass_md5[21];
    264                 md5_state_t md5_state;
     263                guint8 pass_md5[21];
     264                GChecksum *md5_state;
     265                gsize digest_len = MD5_HASH_SIZE;
    265266                char *encoded;
    266267
    267268                random_bytes(pass_md5 + 16, 5);
    268                 md5_init(&md5_state);
    269                 md5_append(&md5_state, (md5_byte_t *) argv[3], strlen(argv[3]));
    270                 md5_append(&md5_state, pass_md5 + 16, 5);   /* Add the salt. */
    271                 md5_finish(&md5_state, pass_md5);
     269                md5_state = g_checksum_new(G_CHECKSUM_MD5);
     270                g_checksum_update(md5_state, (guint8 *) argv[3], strlen(argv[3]));
     271                g_checksum_update(md5_state, pass_md5 + 16, 5);   /* Add the salt. */
     272                g_checksum_get_digest(md5_state, pass_md5, &digest_len);
     273                g_checksum_free(md5_state);
    272274
    273275                encoded = base64_encode(pass_md5, 21);
Note: See TracChangeset for help on using the changeset viewer.