Sat, 11 Jul 2015 14:45:46 -0400
facebook: fixed all errors being marked as fatal
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Original md4 taken from linux kernel |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * MD4 Message Digest Algorithm (RFC1320). |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Implementation derived from Andrew Tridgell and Steve French's |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * CIFS MD4 implementation, and the cryptoapi implementation |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * originally based on the public domain implementation written |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * by Colin Plumb in 1993. |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
31422
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
10 | * Copyright (c) Andrew Tridgell 1997-1998. |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
11 | * Modified by Steve French (sfrench@us.ibm.com) 2002 |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
12 | * Copyright (c) Cryptoapi developers. |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
13 | * Copyright (c) 2002 David S. Miller (davem@redhat.com) |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
14 | * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | */ |
|
35026
fde23518e1e5
Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents:
35020
diff
changeset
|
16 | #include "internal.h" |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
17 | #include "md4hash.h" |
|
33911
a924aacd5a37
ciphers cleanup: encryption and decryption lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33910
diff
changeset
|
18 | |
| 34538 | 19 | #include <string.h> |
| 20 | ||
| 21 | #define MD4_DIGEST_SIZE 16 | |
| 22 | #define MD4_BLOCK_WORDS 16 | |
|
34540
debeae4131ca
Added get_block_size to PurpleMD4Cipher
Ankit Vani <a@nevitus.org>
parents:
34538
diff
changeset
|
23 | #define MD4_HASH_WORDS 4 |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
25 | #define PURPLE_MD4_HASH_GET_PRIVATE(obj) \ |
|
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
26 | (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MD4_HASH, PurpleMD4HashPrivate)) |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | |
| 34538 | 28 | /****************************************************************************** |
| 29 | * Structs | |
| 30 | *****************************************************************************/ | |
| 31 | typedef struct { | |
|
34540
debeae4131ca
Added get_block_size to PurpleMD4Cipher
Ankit Vani <a@nevitus.org>
parents:
34538
diff
changeset
|
32 | guint32 hash[MD4_HASH_WORDS]; |
|
31422
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
33 | guint32 block[MD4_BLOCK_WORDS]; |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
34 | guint64 byte_count; |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
35 | } PurpleMD4HashPrivate; |
| 34538 | 36 | |
| 37 | /****************************************************************************** | |
| 38 | * Globals | |
| 39 | *****************************************************************************/ | |
| 40 | static GObjectClass *parent_class = NULL; | |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | |
| 34538 | 42 | /****************************************************************************** |
| 43 | * Helpers | |
| 44 | *****************************************************************************/ | |
| 45 | #define ROUND1(a,b,c,d,k,s) \ | |
| 46 | (a = lshift(a + F(b,c,d) + k, s)) | |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | |
| 34538 | 48 | #define ROUND2(a,b,c,d,k,s) \ |
| 49 | (a = lshift(a + G(b,c,d) + k + (guint32)0x5a827999,s)) | |
| 50 | ||
| 51 | #define ROUND3(a,b,c,d,k,s) \ | |
| 52 | (a = lshift(a + H(b,c,d) + k + (guint32)0x6ed9eba1,s)) | |
| 53 | ||
| 54 | static inline guint32 | |
| 55 | lshift(guint32 x, unsigned int s) { | |
| 56 | x &= 0xffffffff; | |
| 57 | return (((x << s) & 0xffffffff) | (x >> (32 - s))); | |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | } |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | |
| 34538 | 60 | static inline guint32 |
| 61 | F(guint32 x, guint32 y, guint32 z) { | |
| 62 | return ((x & y) | ((~x) & z)); | |
| 63 | } | |
| 64 | ||
| 65 | static inline guint32 | |
| 66 | G(guint32 x, guint32 y, guint32 z) { | |
| 67 | return ((x & y) | (x & z) | (y & z)); | |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | } |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | |
| 34538 | 70 | static inline guint32 |
| 71 | H(guint32 x, guint32 y, guint32 z) { | |
| 72 | return (x ^ y ^ z); | |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | } |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | |
| 34538 | 75 | static inline void |
| 76 | le32_to_cpu_array(guint32 *buf, unsigned int words) { | |
| 77 | while(words--) { | |
| 78 | *buf = GUINT_FROM_LE(*buf); | |
|
31422
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
79 | buf++; |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
80 | } |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | } |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | |
| 34538 | 83 | static inline void |
| 84 | cpu_to_le32_array(guint32 *buf, unsigned int words) { | |
| 85 | while(words--) { | |
| 86 | *buf = GUINT_TO_LE(*buf); | |
|
31422
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
87 | buf++; |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
88 | } |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | } |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | |
| 34538 | 91 | static void |
| 92 | md4_transform(guint32 *hash, guint32 const *in) { | |
|
31422
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
93 | guint32 a, b, c, d; |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | |
|
31422
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
95 | a = hash[0]; |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
96 | b = hash[1]; |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
97 | c = hash[2]; |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
98 | d = hash[3]; |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | |
|
31422
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
100 | ROUND1(a, b, c, d, in[0], 3); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
101 | ROUND1(d, a, b, c, in[1], 7); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
102 | ROUND1(c, d, a, b, in[2], 11); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
103 | ROUND1(b, c, d, a, in[3], 19); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
104 | ROUND1(a, b, c, d, in[4], 3); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
105 | ROUND1(d, a, b, c, in[5], 7); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
106 | ROUND1(c, d, a, b, in[6], 11); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
107 | ROUND1(b, c, d, a, in[7], 19); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
108 | ROUND1(a, b, c, d, in[8], 3); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
109 | ROUND1(d, a, b, c, in[9], 7); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
110 | ROUND1(c, d, a, b, in[10], 11); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
111 | ROUND1(b, c, d, a, in[11], 19); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
112 | ROUND1(a, b, c, d, in[12], 3); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
113 | ROUND1(d, a, b, c, in[13], 7); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
114 | ROUND1(c, d, a, b, in[14], 11); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
115 | ROUND1(b, c, d, a, in[15], 19); |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | |
|
31422
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
117 | ROUND2(a, b, c, d,in[ 0], 3); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
118 | ROUND2(d, a, b, c, in[4], 5); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
119 | ROUND2(c, d, a, b, in[8], 9); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
120 | ROUND2(b, c, d, a, in[12], 13); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
121 | ROUND2(a, b, c, d, in[1], 3); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
122 | ROUND2(d, a, b, c, in[5], 5); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
123 | ROUND2(c, d, a, b, in[9], 9); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
124 | ROUND2(b, c, d, a, in[13], 13); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
125 | ROUND2(a, b, c, d, in[2], 3); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
126 | ROUND2(d, a, b, c, in[6], 5); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
127 | ROUND2(c, d, a, b, in[10], 9); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
128 | ROUND2(b, c, d, a, in[14], 13); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
129 | ROUND2(a, b, c, d, in[3], 3); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
130 | ROUND2(d, a, b, c, in[7], 5); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
131 | ROUND2(c, d, a, b, in[11], 9); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
132 | ROUND2(b, c, d, a, in[15], 13); |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | |
|
31422
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
134 | ROUND3(a, b, c, d,in[ 0], 3); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
135 | ROUND3(d, a, b, c, in[8], 9); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
136 | ROUND3(c, d, a, b, in[4], 11); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
137 | ROUND3(b, c, d, a, in[12], 15); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
138 | ROUND3(a, b, c, d, in[2], 3); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
139 | ROUND3(d, a, b, c, in[10], 9); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
140 | ROUND3(c, d, a, b, in[6], 11); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
141 | ROUND3(b, c, d, a, in[14], 15); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
142 | ROUND3(a, b, c, d, in[1], 3); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
143 | ROUND3(d, a, b, c, in[9], 9); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
144 | ROUND3(c, d, a, b, in[5], 11); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
145 | ROUND3(b, c, d, a, in[13], 15); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
146 | ROUND3(a, b, c, d, in[3], 3); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
147 | ROUND3(d, a, b, c, in[11], 9); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
148 | ROUND3(c, d, a, b, in[7], 11); |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
149 | ROUND3(b, c, d, a, in[15], 15); |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | |
|
31422
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
151 | hash[0] += a; |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
152 | hash[1] += b; |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
153 | hash[2] += c; |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
154 | hash[3] += d; |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | } |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | |
| 34538 | 157 | static inline void |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
158 | md4_transform_helper(PurpleHash *hash) { |
|
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
159 | PurpleMD4HashPrivate *priv = PURPLE_MD4_HASH_GET_PRIVATE(hash); |
| 34538 | 160 | |
| 161 | le32_to_cpu_array(priv->block, sizeof(priv->block) / sizeof(guint32)); | |
| 162 | md4_transform(priv->hash, priv->block); | |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | } |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | |
| 34538 | 165 | /****************************************************************************** |
| 166 | * Hash Stuff | |
| 167 | *****************************************************************************/ | |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | static void |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
169 | purple_md4_hash_reset(PurpleHash *hash) { |
|
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
170 | PurpleMD4HashPrivate *priv = PURPLE_MD4_HASH_GET_PRIVATE(hash); |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | |
| 34538 | 172 | priv->hash[0] = 0x67452301; |
| 173 | priv->hash[1] = 0xefcdab89; | |
| 174 | priv->hash[2] = 0x98badcfe; | |
| 175 | priv->hash[3] = 0x10325476; | |
| 176 | ||
| 177 | priv->byte_count = 0; | |
| 178 | ||
| 179 | memset(priv->block, 0, sizeof(priv->block)); | |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | } |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | static void |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
183 | purple_md4_hash_append(PurpleHash *hash, const guchar *data, size_t len) { |
|
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
184 | PurpleMD4HashPrivate *priv = PURPLE_MD4_HASH_GET_PRIVATE(hash); |
| 34538 | 185 | const guint32 avail = sizeof(priv->block) - (priv->byte_count & 0x3f); |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | |
| 34538 | 187 | priv->byte_count += len; |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | |
| 34538 | 189 | if(avail > len) { |
| 190 | memcpy((char *)priv->block + | |
| 191 | (sizeof(priv->block) - avail), | |
| 192 | data, len); | |
|
31422
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
193 | return; |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
194 | } |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | |
| 34538 | 196 | memcpy((char *)priv->block + |
| 197 | (sizeof(priv->block) - avail), | |
| 198 | data, avail); | |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
200 | md4_transform_helper(hash); |
|
31422
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
201 | data += avail; |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
202 | len -= avail; |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | |
| 34538 | 204 | while(len >= sizeof(priv->block)) { |
| 205 | memcpy(priv->block, data, sizeof(priv->block)); | |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
206 | md4_transform_helper(hash); |
| 34538 | 207 | data += sizeof(priv->block); |
| 208 | len -= sizeof(priv->block); | |
|
31422
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
209 | } |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | |
| 34538 | 211 | memcpy(priv->block, data, len); |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | } |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | |
| 34538 | 214 | static gboolean |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
215 | purple_md4_hash_digest(PurpleHash *hash, guchar *out, size_t len) |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | { |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
217 | PurpleMD4HashPrivate *priv = PURPLE_MD4_HASH_GET_PRIVATE(hash); |
| 34538 | 218 | const unsigned int offset = priv->byte_count & 0x3f; |
| 219 | gchar *p = (gchar *)priv->block + offset; | |
| 220 | gint padding = 56 - (offset + 1); | |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | |
| 34538 | 222 | if(len < 16) |
| 223 | return FALSE; | |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | |
|
31422
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
225 | *p++ = 0x80; |
| 34538 | 226 | |
| 227 | if(padding < 0) { | |
| 228 | memset(p, 0x00, padding + sizeof(guint64)); | |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
229 | md4_transform_helper(hash); |
| 34538 | 230 | p = (gchar *)priv->block; |
|
31422
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
231 | padding = 56; |
|
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
232 | } |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
233 | |
|
31422
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
234 | memset(p, 0, padding); |
| 34538 | 235 | priv->block[14] = priv->byte_count << 3; |
| 236 | priv->block[15] = priv->byte_count >> 29; | |
| 237 | le32_to_cpu_array(priv->block, | |
| 238 | (sizeof(priv->block) - sizeof(guint64)) / | |
| 239 | sizeof(guint32)); | |
| 240 | md4_transform(priv->hash, priv->block); | |
| 241 | cpu_to_le32_array(priv->hash, sizeof(priv->hash) / sizeof(guint32)); | |
| 242 | memcpy(out, priv->hash, sizeof(priv->hash)); | |
| 243 | ||
|
31422
f7657d6a2bec
Fixed indentation, forgot to do so on my first commit. Added additional info from cipher.c to the file header
Gary Kramlich <grim@reaperworld.com>
parents:
31421
diff
changeset
|
244 | return TRUE; |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | } |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
246 | |
| 34538 | 247 | static size_t |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
248 | purple_md4_hash_get_digest_size(PurpleHash *hash) |
|
33909
773899cbd05a
ciphers cleanup: salt and digest lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33908
diff
changeset
|
249 | { |
|
773899cbd05a
ciphers cleanup: salt and digest lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33908
diff
changeset
|
250 | return 16; |
|
773899cbd05a
ciphers cleanup: salt and digest lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33908
diff
changeset
|
251 | } |
|
773899cbd05a
ciphers cleanup: salt and digest lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33908
diff
changeset
|
252 | |
|
34540
debeae4131ca
Added get_block_size to PurpleMD4Cipher
Ankit Vani <a@nevitus.org>
parents:
34538
diff
changeset
|
253 | static size_t |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
254 | purple_md4_hash_get_block_size(PurpleHash *hash) |
|
34540
debeae4131ca
Added get_block_size to PurpleMD4Cipher
Ankit Vani <a@nevitus.org>
parents:
34538
diff
changeset
|
255 | { |
|
debeae4131ca
Added get_block_size to PurpleMD4Cipher
Ankit Vani <a@nevitus.org>
parents:
34538
diff
changeset
|
256 | /* This does not change (in this case) */ |
|
debeae4131ca
Added get_block_size to PurpleMD4Cipher
Ankit Vani <a@nevitus.org>
parents:
34538
diff
changeset
|
257 | return 64; |
|
debeae4131ca
Added get_block_size to PurpleMD4Cipher
Ankit Vani <a@nevitus.org>
parents:
34538
diff
changeset
|
258 | } |
|
debeae4131ca
Added get_block_size to PurpleMD4Cipher
Ankit Vani <a@nevitus.org>
parents:
34538
diff
changeset
|
259 | |
| 34538 | 260 | /****************************************************************************** |
| 261 | * Object Stuff | |
| 262 | *****************************************************************************/ | |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
263 | static void |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
264 | purple_md4_hash_class_init(PurpleMD4HashClass *klass) { |
|
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
265 | PurpleHashClass *hash_class = PURPLE_HASH_CLASS(klass); |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
266 | |
| 34538 | 267 | parent_class = g_type_class_peek_parent(klass); |
| 268 | ||
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
269 | g_type_class_add_private(klass, sizeof(PurpleMD4HashPrivate)); |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
271 | hash_class->reset = purple_md4_hash_reset; |
|
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
272 | hash_class->reset_state = purple_md4_hash_reset; |
|
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
273 | hash_class->append = purple_md4_hash_append; |
|
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
274 | hash_class->digest = purple_md4_hash_digest; |
|
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
275 | hash_class->get_digest_size = purple_md4_hash_get_digest_size; |
|
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
276 | hash_class->get_block_size = purple_md4_hash_get_block_size; |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
277 | } |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
278 | |
| 34538 | 279 | /****************************************************************************** |
| 280 | * API | |
| 281 | *****************************************************************************/ | |
| 282 | GType | |
|
35020
0ab63ada3cf2
Changed *_get_gtype to *_get_type for ciphers and hashes so gtk-doc can find them
Ankit Vani <a@nevitus.org>
parents:
34965
diff
changeset
|
283 | purple_md4_hash_get_type(void) { |
| 34538 | 284 | static GType type = 0; |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
285 | |
| 34538 | 286 | if(type == 0) { |
| 287 | static const GTypeInfo info = { | |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
288 | sizeof(PurpleMD4HashClass), |
| 34538 | 289 | NULL, |
| 290 | NULL, | |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
291 | (GClassInitFunc)purple_md4_hash_class_init, |
| 34538 | 292 | NULL, |
| 293 | NULL, | |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
294 | sizeof(PurpleMD4Hash), |
| 34538 | 295 | 0, |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
296 | (GInstanceInitFunc)purple_hash_reset, |
| 34538 | 297 | NULL, |
| 298 | }; | |
| 299 | ||
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
300 | type = g_type_register_static(PURPLE_TYPE_HASH, |
|
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
301 | "PurpleMD4Hash", |
| 34538 | 302 | &info, 0); |
| 303 | } | |
| 304 | ||
| 305 | return type; | |
|
31421
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
306 | } |
|
713fb035d563
Created a new branch to break the ciphers out to their own files. Also I've now exposed purple_g_checksum_* if we're on glib >= 2.16.0
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
307 | |
|
34566
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
308 | PurpleHash * |
|
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
309 | purple_md4_hash_new(void) { |
|
e0f887dee077
Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents:
34547
diff
changeset
|
310 | return g_object_new(PURPLE_TYPE_MD4_HASH, NULL); |
| 34538 | 311 | } |