summaryrefslogtreecommitdiff
path: root/src/skey/md5.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/skey/md5.c')
-rw-r--r--src/skey/md5.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/skey/md5.c b/src/skey/md5.c
index 9447c15..de9d7a7 100644
--- a/src/skey/md5.c
+++ b/src/skey/md5.c
@@ -12,9 +12,9 @@ int MD5Keycrunch(char *result, const char *seed, const char *passhrase)
{
char *buf;
gsize len;
- GChecksum *checksum;
- guint8 digest[16];
- gsize digest_len = sizeof (digest);
+ GChecksum *checksum;
+ guint8 digest[16];
+ gsize digest_len = sizeof (digest);
guint32 *results;
len = strlen(seed) + strlen(passhrase);
@@ -27,41 +27,41 @@ int MD5Keycrunch(char *result, const char *seed, const char *passhrase)
strcat(buf, passhrase);
skey_sevenbit(buf);
- checksum = g_checksum_new (G_CHECKSUM_MD5);
- g_checksum_update (checksum, (const guchar *) buf, len);
+ checksum = g_checksum_new (G_CHECKSUM_MD5);
+ g_checksum_update (checksum, (const guchar *) buf, len);
g_free(buf);
- g_checksum_get_digest (checksum, digest, &digest_len);
- g_assert (digest_len == 16);
+ g_checksum_get_digest (checksum, digest, &digest_len);
+ g_assert (digest_len == 16);
- results = (guint32 *) digest;
+ results = (guint32 *) digest;
results[0] ^= results[2];
results[1] ^= results[3];
memcpy((void *)result, (void *)results, SKEY_SIZE);
- g_checksum_free (checksum);
+ g_checksum_free (checksum);
return 0;
}
void MD5SKey(char *x)
{
- GChecksum *checksum;
- guint8 digest[16];
- gsize digest_len = sizeof (digest);
+ GChecksum *checksum;
+ guint8 digest[16];
+ gsize digest_len = sizeof (digest);
guint32 *results;
- checksum = g_checksum_new (G_CHECKSUM_MD5);
- g_checksum_update (checksum, (const guchar *) x, SKEY_SIZE);
- g_checksum_get_digest (checksum, digest, &digest_len);
- g_assert (digest_len == 16);
+ checksum = g_checksum_new (G_CHECKSUM_MD5);
+ g_checksum_update (checksum, (const guchar *) x, SKEY_SIZE);
+ g_checksum_get_digest (checksum, digest, &digest_len);
+ g_assert (digest_len == 16);
- results = (guint32 *) digest;
+ results = (guint32 *) digest;
results[0] ^= results[2];
results[1] ^= results[3];
memcpy((void *)x, (void *)results, SKEY_SIZE);
- g_checksum_free (checksum);
+ g_checksum_free (checksum);
}